BroadRouter
Get started

OpenAI-compatible API base URLs: 14 providers, checked

By the BroadNet Inference team · 6 min read · Published

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.

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 pages.

How do you set the base URL in code?

In Python, pass base_url to the client:

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:

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:

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

Full walk-throughs: OpenAI Python SDK, OpenAI Node SDK. For what a 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:

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 has more examples, and the 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.

Which endpoints does BroadNet Inference support?

BroadNet’s API reference 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 and 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.
  • 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 shows how, in a client or in LiteLLM. The LiteLLM proxy guide shows a BroadNet entry. For background on the term, see 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.

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.

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity