---
title: "OpenAI-compatible API base URLs for 14 providers | BroadRouter"
description: "The base_url for 14 OpenAI-compatible LLM APIs, each read from the provider's own docs, with the endpoints they list and the quirks that break a drop-in switch."
url: https://broadrouter.com/blog/openai-compatible-api-base-urls/
lang: en
updated: 2026-11-15
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# OpenAI-compatible API base URLs: 14 providers, checked

By the BroadNet Inference team · 6 min read · Published 2026-11-15

An OpenAI-compatible API lets you keep the OpenAI SDK and change two things: base\_url and the API key. The base URL differs by provider, for example https://api.groq.com/openai/v1 for Groq, https://openrouter.ai/api/v1 for OpenRouter and https://inference.broadnet.ai/v1 for BroadNet Inference. Paths, model IDs and supported parameters still differ, so test one request before you switch.

## Key takeaways

-   Most providers end the base URL in /v1, but not all: DeepSeek uses no version path, Z.ai uses /api/paas/v4/ and Gemini uses /v1beta/openai/.
-   Set base\_url to the root the SDK appends /chat/completions to. Never paste the full /chat/completions path into base\_url.
-   "Compatible" rarely means every endpoint. Check which of chat completions, audio transcriptions, embeddings and the Responses API each provider documents.
-   Model IDs change with the provider: deepseek-ai/DeepSeek-V4-Flash-0731 on DeepInfra, accounts/fireworks/models/… on Fireworks, broadnet/… on BroadNet.
-   Anthropic says its OpenAI layer is mainly for testing; xAI calls the Responses API the preferred way in. Use native APIs where the provider says so.

**On this page**

1.  What is the base URL for each OpenAI-compatible provider?
2.  How do you set the base URL in code?
3.  How do you test a new base URL with curl?
4.  What are the common mistakes when changing base\_url?
5.  Which endpoints does BroadNet Inference support?
6.  Should you route several providers through one base URL?
7.  Where BroadNet Inference fits

An OpenAI-compatible API accepts the same request shape as OpenAI’s API, so the official OpenAI SDKs work after you change `base_url` and the API key. The hard part is that every provider puts its endpoint somewhere slightly different. The table below lists 14, each read from the provider’s own documentation on 15 November 2026.

## What is the base URL for each OpenAI-compatible provider?

| Provider | Base URL | What its OpenAI-compatibility docs list | Quirks the docs state |
| --- | --- | --- | --- |
| OpenAI | `https://api.openai.com/v1` | Everything; it is the reference | SDK default when nothing is set |
| Anthropic | `https://api.anthropic.com/v1/` | Chat completions | “Primarily intended to test and compare model capabilities”; `strict` ignored; audio and file inputs return 400 |
| Google Gemini | `https://generativelanguage.googleapis.com/v1beta/openai/` | Chat completions, embeddings, image generation, models, batch | OpenAI library support “still in beta”; no Responses API listed |
| DeepSeek | `https://api.deepseek.com` | Chat completions | No version path; separate Anthropic-format URL at `/anthropic` |
| Groq | `https://api.groq.com/openai/v1` | Chat completions, Responses API; notes on audio transcription | `logprobs`, `logit_bias`, `top_logprobs`, `messages[].name` return 400; `n` must be 1; no `srt` or `vtt` transcripts |
| Together AI | `https://api.together.ai/v1` | Chat, completions, images, speech, transcriptions, models, Responses | US-only inference at `https://us-api.together.ai/v1`; embeddings only on dedicated endpoints |
| Fireworks AI | `https://api.fireworks.ai/inference/v1` | Chat completions | Model IDs like `accounts/fireworks/models/…`; lowers `max_tokens` to fit the context instead of erroring, unless told otherwise |
| DeepInfra | `https://api.deepinfra.com/v1/openai` | Chat completions; Responses clients use the same base | Embeddings, images and speech documented on a separate page |
| Mistral AI | `https://api.mistral.ai/v1` | `POST /v1/chat/completions` | Its API reference does not call itself OpenAI-compatible; test before relying on it |
| OpenRouter | `https://openrouter.ai/api/v1` | Chat completions | Optional `HTTP-Referer` and `X-OpenRouter-Title` headers for its rankings |
| xAI | `https://api.x.ai/v1` | Responses API | Its guide says “The Responses API is the preferred way of interacting with our models” |
| Z.ai (GLM) | `https://api.z.ai/api/paas/v4/` | Chat completions | `v4` path, not `v1` |
| Alibaba Model Studio | `https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1` (Singapore) | Chat completions | Workspace ID in the host; a key works only in the region where it was created, otherwise 401 |
| BroadNet Inference | `https://inference.broadnet.ai/v1` | Chat completions, audio transcriptions | Model IDs start with `broadnet/`; see below |

Alibaba also lists a US (Virginia) endpoint on `us-east-1`. Its Beijing row on the same page shows the Singapore host while other text on the page names `cn-beijing`, so confirm a China endpoint in the console. The table is a snapshot. Endpoints move: Anthropic’s and Google’s docs both redirected to new addresses while we checked them.

For prices across these providers, see the [LLM API pricing by provider](https://broadrouter.com/llm-api-pricing/providers/) pages.

## How do you set the base URL in code?

In Python, pass `base_url` to the client:

```python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://inference.broadnet.ai/v1",
    api_key=os.environ["BROADNET_API_KEY"],
)
r = client.chat.completions.create(
    model="broadnet/gemma-4-26b-a4b",
    messages=[{"role": "user", "content": "Say hello in one line."}],
)
print(r.choices[0].message.content)
```

In Node, the option is `baseURL`:

```js
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://inference.broadnet.ai/v1",
  apiKey: process.env.BROADNET_API_KEY,
});
```

Or set it once for every tool that uses the official SDKs. The Node SDK’s source defaults `baseURL` to `process.env['OPENAI_BASE_URL']`, then to `https://api.openai.com/v1`; the Python README documents the same variable:

```bash
export OPENAI_BASE_URL="https://inference.broadnet.ai/v1"
export OPENAI_API_KEY="your-key"
```

Full walk-throughs: [OpenAI Python SDK](https://broadrouter.com/guides/openai-python-sdk/), [OpenAI Node SDK](https://broadrouter.com/guides/openai-node-sdk/). For what a [base URL](https://broadrouter.com/glossary/base-url/) is and why tools ask for it, see the glossary.

## How do you test a new base URL with curl?

Send one tiny request before you change any application code:

```bash
curl https://inference.broadnet.ai/v1/chat/completions \
  -H "Authorization: Bearer $BROADNET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "broadnet/gemma-4-26b-a4b", "messages": [{"role": "user", "content": "ping"}], "max_tokens": 20}'
```

Swap the base URL, key and model for the provider you are testing. A 200 with a `choices` array means the path, key and model ID are right. A 404 usually means the path is wrong; a 401 means the key or region is wrong; a 400 often names the parameter the provider rejects. The [curl quickstart](https://broadrouter.com/guides/curl-quickstart/) has more examples, and the [API request builder](https://broadrouter.com/tools/api-request-builder/) writes the curl, Python and Node versions for you.

## What are the common mistakes when changing base\_url?

-   **Pasting the full endpoint.** The SDK appends `/chat/completions`. A base URL that already ends in it gives `/chat/completions/chat/completions` and a 404.
-   **Adding or dropping `/v1` by habit.** DeepSeek’s documented base has no `/v1`, Z.ai’s ends in `/v4/` and Gemini’s in `/v1beta/openai/`. Copy the provider’s exact string.
-   **Keeping OpenAI model names.** `gpt-…` names fail elsewhere. Each provider has its own format: `deepseek-ai/DeepSeek-V4-Flash-0731` on DeepInfra, `accounts/fireworks/models/…` on Fireworks, `broadnet/deepseek-v4.1-flash` on BroadNet.
-   **Sending parameters the provider rejects or ignores.** Groq returns 400 for `logprobs`; Anthropic’s layer silently ignores `seed`, `logit_bias` and `reasoning_effort`. A silently ignored parameter is worse than an error, because nothing tells you.
-   **Assuming the same response fields.** Anthropic’s layer returns empty `prompt_tokens_details`, so cached-token reporting is missing. Fireworks puts streaming usage in the last chunk, which the SDK types may not declare.
-   **Assuming every endpoint exists.** “OpenAI-compatible” usually means chat completions. Embeddings, audio, image generation and the Responses API are separate questions, as the table shows.
-   **Mixing regions.** Alibaba keys are bound to a region, and Together offers a separate US-only host. A valid key on the wrong host still fails.

The full pre-switch list is in the [OpenAI-compatible migration checklist](https://broadrouter.com/blog/openai-compatible-api-migration-checklist/).

## Which endpoints does BroadNet Inference support?

BroadNet’s [API reference](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-openai-compatible-api-base-urls&utm_content=body) documents two model endpoints on `https://inference.broadnet.ai/v1`, plus `GET /v1/models` for catalogue metadata:

| Endpoint | Models |
| --- | --- |
| `POST /v1/chat/completions` | DeepSeek V4.1 Flash, GLM 5.3, Qwen3.8 27B, BroadNet Gemma 4 VL 26B |
| `POST /v1/audio/transcriptions` | BroadNet Transcribe Arabic, BroadNet Transcribe (14 languages) |

What that means in practice:

-   **No embeddings, image generation or Responses API** are documented. A tool that requires one of them needs a second provider for that part.
-   **Tool calling and structured output** are documented for [GLM 5.3](https://broadrouter.com/models/glm-5.3/) and [Qwen3.8 27B](https://broadrouter.com/models/qwen3.8-27b/).
-   **Images go in as `data:` URLs** inside `image_url` content parts, on DeepSeek V4.1 Flash, Qwen3.8 27B and Gemma 4 VL 26B.
-   **Reasoning models** (DeepSeek V4.1 Flash, GLM 5.3, Qwen3.8 27B) count reasoning toward `max_tokens`. Leave 1,000 tokens or more, or set `reasoning_effort` to `low`, as the docs advise; see [why reasoning models return empty answers](https://broadrouter.com/guides/reasoning-tokens-empty-response/).
-   **A model list answered** when we called `GET /v1/models` on 15 November 2026, but it is not in the documented endpoint list, so don’t build on it.
-   **Limits** on pay-as-you-go keys are 30 requests a minute and 4 in flight.

Prices per 1M tokens: DeepSeek V4.1 Flash $0.175 input and $0.52 output, Gemma 4 VL 26B $0.10 and $0.22. DeepSeek V4.1 Flash is also sold as a flat plan at $60 a month per session, one request at a time.

## Should you route several providers through one base URL?

If your app calls several of these providers, a proxy such as LiteLLM gives your code one base URL and maps model names to each upstream. You choose the mapping; nothing switches providers for you unless you configure fallbacks yourself. [LLM API failover](https://broadrouter.com/blog/llm-api-failover-fallback/) shows how, in a client or in LiteLLM. The [LiteLLM proxy guide](https://broadrouter.com/guides/litellm-proxy-custom-provider/) shows a BroadNet entry. For background on the term, see [OpenAI-compatible API](https://broadrouter.com/glossary/openai-compatible-api/).

## Where BroadNet Inference fits

BroadNet is a good fit if your code already speaks chat completions and you want open models, Arabic and multilingual speech to text, or a flat-rate DeepSeek session on one key. It is not a fit if you need embeddings, the Responses API or image generation from the same provider; Together AI and Gemini document more of the OpenAI surface. Check our table against each provider’s docs before you ship, because these URLs and endpoint lists change.

Free tools for this

-   [OpenAI to BroadNet migration helper](https://broadrouter.com/tools/openai-to-broadnet-migration/) Paste OpenAI SDK code; get base URL, key and model edits, a diff and the checks that remain.
-   [max\_tokens calculator for reasoning models](https://broadrouter.com/tools/reasoning-token-budget/) Answer length + reasoning budget + margin = a max\_tokens that does not cut the answer off.
-   [JSON schema generator for LLM structured output](https://broadrouter.com/tools/json-schema-generator/) Sample JSON to strict schema, Pydantic, Zod and a ready request.
-   [LLM JSON output validator](https://broadrouter.com/tools/llm-json-output-validator/) Parse errors by line and column, safe repairs, cut-off detection and JSON Schema checks for model output.

[All free tools](https://broadrouter.com/tools/)

## Terms in this article

[Chat Completions API](https://broadrouter.com/glossary/chat-completions-api/)

The Chat Completions API is OpenAI's HTTP endpoint, POST /v1/chat/completions, that takes a model name and a list of role-tagged messages and returns the model's next message. Its request and response shape became the common format that OpenAI-compatible providers and SDKs reuse.

[Base URL](https://broadrouter.com/glossary/base-url/)

A base URL is the fixed root address of an API, such as https://api.example.com/v1, that a client puts in front of every endpoint path, such as /chat/completions. In OpenAI-compatible SDKs, changing the base URL, together with the API key and model ID, points the same code at a different provider.

[Embeddings](https://broadrouter.com/glossary/embeddings/)

Embeddings are lists of floating-point numbers (vectors) that a model produces to represent a piece of text, an image or other input. Inputs with similar meaning get vectors that are close together, so distance between vectors can rank search results, cluster documents or find related items.

[Token](https://broadrouter.com/glossary/token/)

A token is the unit of text a language model reads and writes: a word, part of a word, a punctuation mark or a byte sequence produced by the model's tokenizer. LLM APIs count, limit and usually bill usage in tokens.

[Pay-as-you-go](https://broadrouter.com/glossary/pay-as-you-go/)

Pay-as-you-go is a pricing model in which you pay only for what you use, metered per unit such as tokens, requests or audio minutes, with no subscription or minimum commitment. Most LLM APIs bill this way, from a prepaid balance or a periodic invoice.

[Tool calling](https://broadrouter.com/glossary/tool-calling/)

Tool calling, also called function calling, is an LLM API feature in which the model returns a structured request to run a function the developer has defined, with JSON arguments. The application runs the function and sends the result back; the model never runs code itself.

[OpenAI-compatible API](https://broadrouter.com/glossary/openai-compatible-api/)

An OpenAI-compatible API is an HTTP API that accepts the same request and response formats as the OpenAI API, such as POST /v1/chat/completions, so OpenAI SDKs and tools can use it by changing only the base URL, the API key and the model name.

[Speech-to-text](https://broadrouter.com/glossary/speech-to-text/)

Speech-to-text, also called automatic speech recognition (ASR), is technology that converts spoken audio into written text. A speech-to-text API accepts an audio file or stream and returns a transcript, usually priced per minute of audio. Accuracy is measured with word error rate and varies with accent, dialect and recording quality.

## Questions

### What is the OpenAI API base URL?

https://api.openai.com/v1. The official Node SDK uses it when you set neither baseURL nor the OPENAI\_BASE\_URL environment variable.

### Should base\_url end in /v1 or /chat/completions?

End it where the provider's docs end it, usually /v1. The SDK adds /chat/completions itself, so a base URL that already ends in /chat/completions produces a 404.

### Can I set the base URL with an environment variable?

Yes. Both official OpenAI SDKs read OPENAI\_BASE\_URL, and many tools built on them do too. Set OPENAI\_API\_KEY alongside it, and check each tool's docs, because some use their own variable names.

### Is the Claude API OpenAI-compatible?

Partly. Anthropic offers https://api.anthropic.com/v1/ for the OpenAI SDK but says the layer is mainly for testing and comparing models, not a long-term production path. It ignores strict on tools and rejects audio and file inputs.

### Which endpoints does BroadNet Inference support?

Its docs list POST /v1/chat/completions and POST /v1/audio/transcriptions. They do not list embeddings, image generation or the Responses API.

### Why does my request work with OpenAI but fail on another provider?

Usually a model ID in the wrong format, or a parameter the provider rejects. Groq, for example, returns 400 for logprobs, logit\_bias, top\_logprobs and messages\[\].name. Strip optional parameters and retry with the provider's exact model ID.

## Keep reading

-   [Switching to an OpenAI-compatible API: a migration checklist](https://broadrouter.com/blog/openai-compatible-api-migration-checklist/)
-   [How to choose an LLM API provider: a 20-point checklist](https://broadrouter.com/blog/choose-llm-api-provider-checklist/)
-   [How to evaluate an LLM before switching providers](https://broadrouter.com/blog/evaluate-llm-before-switching/)
-   [LLM streaming explained: SSE chunks, deltas, usage and cancel](https://broadrouter.com/blog/llm-streaming-sse-explained/)
-   [A private endpoint starts with a clear workload](https://broadrouter.com/blog/private-endpoint-planning/)
-   [Before fine-tuning: define the problem to solve](https://broadrouter.com/blog/fine-tuning-readiness/)
-   [Guide: Use the OpenAI Python SDK with BroadNet Inference](https://broadrouter.com/guides/openai-python-sdk/)
-   [Guide: Use the OpenAI Node.js SDK with BroadNet Inference](https://broadrouter.com/guides/openai-node-sdk/)
-   [Guide: First request to BroadNet Inference with curl](https://broadrouter.com/guides/curl-quickstart/)
-   [Guide: Route LiteLLM to BroadNet Inference (SDK and proxy)](https://broadrouter.com/guides/litellm-proxy-custom-provider/)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-openai-compatible-api-base-urls&utm_content=page-cta) ·

**Sources**

-   [OpenAI Node SDK source, client.ts: default base URL and OPENAI\_BASE\_URL (checked 2026-11-15)](https://github.com/openai/openai-node/blob/master/src/client.ts)
-   [OpenAI Python SDK README: base\_url and OPENAI\_BASE\_URL (checked 2026-11-15)](https://github.com/openai/openai-python)
-   [Anthropic, OpenAI SDK compatibility (checked 2026-11-15)](https://platform.claude.com/docs/en/api/openai-sdk)
-   [Google, Gemini OpenAI compatibility (checked 2026-11-15)](https://aistudio.google.com/docs/openai)
-   [DeepSeek API docs, first API call (checked 2026-11-15)](https://api-docs.deepseek.com/)
-   [Groq, OpenAI compatibility (checked 2026-11-15)](https://console.groq.com/docs/openai)
-   [Together AI, OpenAI API compatibility (checked 2026-11-15)](https://docs.together.ai/docs/openai-api-compatibility)
-   [Fireworks AI, OpenAI compatibility (checked 2026-11-15)](https://docs.fireworks.ai/tools-sdks/openai-compatibility)
-   [DeepInfra, chat completions overview (checked 2026-11-15)](https://docs.deepinfra.com/chat/overview)
-   [Mistral AI API reference (checked 2026-11-15)](https://docs.mistral.ai/api/)
-   [OpenRouter quickstart (checked 2026-11-15)](https://openrouter.ai/docs/quickstart)
-   [xAI API reference and chat guide (checked 2026-11-15)](https://docs.x.ai/docs/guides/chat)
-   [Z.ai, OpenAI Python SDK guide (checked 2026-11-15)](https://docs.z.ai/guides/develop/openai/python)
-   [Alibaba Cloud Model Studio, OpenAI compatibility (checked 2026-11-15)](https://www.alibabacloud.com/help/en/model-studio/compatibility-of-openai-with-dashscope)
-   [BroadNet Inference API reference (checked 2026-11-15)](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-openai-compatible-api-base-urls&utm_content=sources)
