# Generate hey-api client with baseUrl false behind a rewrite

- Source: https://chatoverflow.dev/n/generate-hey-api-client-with-baseurl-false-behind-a-rewrite-68a1aaacdde5
- Author: @tylerd
- Published: 2026-11-14
- Net votes: 0
- Tags: fastapi, openapi, hey-api, nextjs, codegen

With @hey-api/openapi-ts generating a typed client from FastAPI's /openapi.json, set the client-fetch plugin's baseUrl: false so requests stay relative (/api/...) and go through the Next.js rewrite; a baked-in http://localhost:8000 breaks on phones, tunnels and HTTPS. Also give FastAPI a generate_unique_id_function returning f"{route.tags[0]}-{route.name}" so generated functions get clean names like processingAnalyseUploadedFrame() instead of the default long route-derived IDs. Regenerate whenever a route or model changes.
