OpenAI-Compatible API Base URL Cheatsheet
The exact base_url, auth header and a working OpenAI SDK snippet for 15 providers — OpenAI, Azure, Anthropic, Gemini, Groq, DeepSeek, xAI, OpenRouter and local runtimes. Switch providers by changing three lines. No signup, keys never leave your machine.
How it works
Most modern LLM providers expose an OpenAI-compatible endpoint: the same /chat/completions request and response shape that the official OpenAI SDKs speak. That means you can move an app from OpenAI to a cheaper, faster or self-hosted provider by changing only three things — the base_url, the API key, and the model name. Your request-building and response-parsing code stays identical.
This page is a lookup table, not a calculator. Each provider is a static record — { name, baseUrl, authHeader, envVar, exampleModel, quirks, docUrl, compat } — transcribed from that provider's own official documentation, which is the single citeable source for its base URL. Every row links back to that doc so any value can be re-verified in one click, and the file records a LAST_VERIFIED date (2026-07-08).
The snippet for each provider is generated purely by templating the selected record into a Python, Node or curl skeleton — no computation and no randomness, so the same provider always yields the same code. To keep the reference internally honest, two deterministic checks run on every row. First, the chat endpoint is derived from the base URL exactly as the SDKs do: strip a single trailing slash, then append /chat/completions. That is why Gemini's trailing-slash base URL does not produce a double slash, and DeepSeek's base URL without a /v1 segment still resolves correctly. Second, each base URL is parsed and classified as HTTPS, a local runtime, or a template that still contains a {placeholder} — which is how Azure's {resource} URL is flagged rather than shown as ready-to-run.
The compattag on each row — Full, Chat only or Partial — is taken from the provider's own compatibility statement. Chat completions work everywhere listed; other endpoints and parameters (embeddings, tool calling, logprobs, streaming usage) vary, so the tag tells you when to read the linked docs before depending on a feature. No API key is ever entered, transmitted or stored: snippets read the key from an environment variable, keeping the page fully client-side and safe to use anywhere.
Worked examples
Frequently asked questions
Sources & references
Each base URL is transcribed from the provider's own official documentation — the citeable source of truth for its OpenAI-compatible endpoint:
- OpenAI — API docs
- Azure OpenAI — API docs
- Anthropic (Claude) — API docs
- Google Gemini — API docs
- Groq — API docs
- Together AI — API docs
- Fireworks AI — API docs
- DeepSeek — API docs
- Mistral AI — API docs
- xAI (Grok) — API docs
- OpenRouter — API docs
- Perplexity — API docs
- Ollama (local) — API docs
- LM Studio (local) — API docs
- vLLM (self-hosted) — API docs
All 15 base URLs were last cross-checked against these docs on 2026-07-08. Providers occasionally change paths or add compatibility, so each row links to its live doc for one-click re-verification.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Spotted a base URL that changed, or a provider we should add?
Email me at [email protected] — most fixes ship within 24 hours.