Show notes
The bug behind many failed first requests#
A developer has an API key, a model name and a tool that claims OpenAI compatibility, whether that is Codex CLI, Cursor, LiteLLM, FastGPT, Hermes, a custom SDK client or an internal script. Everything should work, yet the request fails. Look closer and the culprit is often neither the model nor the provider. It is the Base URL.
The common variants are easy to recognize once you know them:
- The URL is missing /v1.
- The user pasted the official OpenAI endpoint together with a gateway key.
- A tracking parameter was attached because someone treated the API URL like a marketing link.
- The user is on an unstable route in their region and never tried the regional endpoint.
- The tool reads OPENAI_BASE_URL while the user set OPENAI_API_BASE, or the reverse, and the wrong variable is silently ignored.
Modern AI development is tool-heavy, and every tool phrases its settings differently, but underneath the core values are always the same three: API key, Base URL and model name.
What a Base URL is and why /v1 matters#
An API Base URL is the root endpoint your client uses before it appends a specific API path. If the Base URL is https://api.crazyrouter.com/v1, a chat completion request goes to /chat/completions under it. The SDK normally builds the full URL for you.
That is why /v1 matters. To a human, https://api.crazyrouter.com and https://api.crazyrouter.com/v1 look nearly identical. To an SDK they are different routing surfaces. For OpenAI-compatible clients, a clean Base URL usually ends with /v1.
Different tools ask for the same value under different names: API endpoint, provider URL, a field buried in a TOML file, or an environment variable. They are all answering the same question: where should this OpenAI-shaped request be sent?
Keep machine endpoints clean#
UTM parameters belong on human-facing links. A blog post or README link can carry a utm_source value. An API endpoint should never end in ?utm_source=github, because an API request is not a marketing click. It is infrastructure.
The rule generalizes: separate human links from machine endpoints. Human links can be tracked; API endpoints should be stable, with no extra query strings unless the API explicitly requires them.
Why the error messages mislead#
A misconfiguration rarely announces itself. Instead it surfaces as something that looks like a different problem:
- A missing /v1 can look like a 404.
- A wrong key can look like 401 Unauthorized.
- A model that does not exist on the selected route can look like a provider failure.
- A long request sent over an unstable route can show up as a timeout or 524.
- A gateway or upstream issue can appear as a 500 or 502.
Good troubleshooting content separates 500, 502, 524, 429, 401 and 403, and says which errors are retryable, which are configuration problems, and which call for model fallback or a simpler request. Try again later is not a diagnosis.
Turn support tickets into documentation and tools#
Every support ticket is a private search query. If enough users ask the same question in chat, many more are searching for it silently. For AI API products, the highest-intent content is practical setup and troubleshooting, because someone searching for a Base URL is trying to make something work right now.
A strong Base URL guide shows the exact endpoint, Python, Node and curl examples, regional endpoints explained simply, wrong-versus-right examples, environment variable names, a link to the model list, and what to send support if the user is still stuck.
Small interactive tools go further. A config generator asks which tool you use, which route and which model, then outputs the exact snippet. An error-code explainer takes the status code, model, endpoint and request type and returns likely causes and next steps. Both remove ambiguity and cut repeat tickets. An AI gateway standardizes integration with one Base URL, one key and many model routes, but only if that first setup step is unmistakable.
A production checklist#
- Keep API endpoints clean: no UTM parameters or stray query strings.
- Include /v1 when the OpenAI-compatible client expects it.
- Separate trackable human links from stable machine endpoints.
- Log endpoint, model, error code, latency and request time.
- Build fallback in: retry temporary failures with backoff, do not retry auth or payload errors, use model fallback for unstable routes, and switch endpoints only deliberately while logging which one worked.
- Treat recurring support themes as a product roadmap.
When a user does need support, route them there with the right metadata: model name, Base URL, request time, error body and whether streaming was enabled. Configuration is part of developer experience, and developer experience is part of reliability.
