OpenAI-Compatible API Base URL Explained: How to Configure Any AI Tool
OpenAI-Compatible API Base URL Explained: How to Configure Any AI Tool
If an AI tool says it supports an “OpenAI-compatible API,” it usually means you do not need a new SDK.
You keep the familiar OpenAI request format, then change three things:
the API key;
the model name;
the API Base URL.
That last one — the Base URL — is where many setup problems happen.
From real support conversations, the most common mistakes are simple:
the endpoint is missing /v1;
the API key is from the wrong provider;
the tool is still sending requests to the official OpenAI endpoint;
the selected model name does not exist on the gateway;
users in a restricted or unstable region are using the wrong route.
This guide explains what the Base URL does and how to configure it in Python, Node.js, curl, Cursor, LiteLLM, FastGPT, and Codex-style tools.
Quick answer
For an OpenAI-compatible client, the Base URL is the root endpoint your SDK sends API requests to.
For Crazyrouter, use:
https://crazyrouter.com/v1
If you are in a region where the global endpoint is unstable, use:
https://cn.crazyrouter.com/v1
Do not add tracking parameters to API endpoints. Human-facing links can use UTM parameters; API Base URLs should stay clean.
What is an API Base URL?
An API Base URL is the prefix used before endpoint paths such as:
/chat/completions /responses /embeddings /images/generations
For example, if your Base URL is:
https://crazyrouter.com/v1
then a chat completion request goes to:
https://crazyrouter.com/v1/chat/completions
The SDK builds that full URL for you.
That is why one missing /v1 can break an otherwise correct setup.
Why OpenAI-compatible APIs are useful
Many tools and SDKs were originally designed for the OpenAI API format.
OpenAI-compatible gateways let developers keep that interface while routing requests to different model families, such as GPT, Claude, Gemini, DeepSeek, Qwen, image models, audio models, and more.
The benefit is practical:
Without an OpenAI-compatible gatewayWith an OpenAI-compatible gatewayDifferent SDKs for different providersOne familiar SDK formatProvider-specific billing and keysOne API key for many model routesHarder fallback between modelsEasier model switching and fallbackMore integration work per toolChange Base URL, API key, and model name
In Crazyrouter’s case, you can use one API layer across 627+ models and keep common OpenAI-compatible tooling.
Crazyrouter Base URL options
Use this table as the default decision guide.
Use caseBase URLStandard OpenAI-compatible API accesshttps://crazyrouter.com/v1Region route for domestic/unstable accesshttps://cn.crazyrouter.com/v1Anthropic native Messages API stylehttps://crazyrouter.comGemini native API styleUse the Gemini-compatible endpoint format in docs
Most users configuring OpenAI SDK, Cursor-style tools, LiteLLM, FastGPT, or custom HTTP clients should start with:
https://crazyrouter.com/v1
Python OpenAI SDK example
Install the OpenAI Python SDK:
pip install openai
Then configure the client with a custom Base URL:
from openai import OpenAI client = OpenAI( api_key="YOUR_CRAZYROUTER_API_KEY", base_url="https://crazyrouter.com/v1" ) response = client.chat.completions.create( model="gpt-5-mini", messages=[ {"role": "user", "content": "Explain API Base URL in one sentence."} ] )
Read the full guide















