Skip to content
BYOK Tools

Setup

OpenAI-compatible endpoints: base URL, key and model name

What an OpenAI-compatible API is, the three values every client needs, and how to point BYOK apps at OpenRouter, Ollama, LM Studio, Groq, DeepSeek and Azure OpenAI.

By the BYOK Tools editorial team · 22 November 2026 · 8 min read

Many providers and local servers implement the same request format as OpenAI's API. Apps describe these as OpenAI-compatible. If an app supports a custom OpenAI-compatible provider, it can usually talk to dozens of services without specific support for each one.

What compatibility means

An OpenAI-compatible server accepts requests in the shape of OpenAI's chat completions endpoint: a POST to /chat/completions with a JSON body containing a model name and a list of messages, and an Authorization header carrying a bearer token. It returns responses in the same structure, including streamed chunks and a usage object with token counts. Most compatible servers also implement /models, and many implement /embeddings.

Compatibility is rarely complete. Tool calling, structured output, image input, reasoning parameters and newer endpoints such as the Responses API vary between implementations. If a feature fails, check the provider's documentation for what it supports.

The three values

Every OpenAI-compatible connection needs:

  1. Base URL. The API root, usually ending in /v1. The client appends paths such as /chat/completions.
  2. API key. Sent as a bearer token. Local servers often ignore it but clients may still require a value.
  3. Model name. The model ID as that provider defines it. IDs differ between providers, even for the same underlying model.

The official OpenAI SDKs read OPENAI_API_KEY and OPENAI_BASE_URL from the environment, and many tools follow the same convention:

export OPENAI_BASE_URL="https://openrouter.ai/api/v1"
export OPENAI_API_KEY="sk-or-..."

A common error is a doubled or missing /v1. If requests return 404, check whether the app expects the base URL with or without it.

Provider reference

Check each provider's documentation for current values. At the time of writing:

Provider Base URL Notes
OpenAI https://api.openai.com/v1 The reference implementation
OpenRouter https://openrouter.ai/api/v1 Model IDs use provider/model-name
Ollama http://localhost:11434/v1 Any non-empty key; model name from ollama list
LM Studio http://localhost:1234/v1 Start the local server in the app first
Groq https://api.groq.com/openai/v1 Key from the Groq console
DeepSeek https://api.deepseek.com The /v1 suffix is also accepted
Google Gemini https://generativelanguage.googleapis.com/v1beta/openai/ Compatibility layer over the Gemini API

Azure OpenAI

Azure differs from the others. Requests go to your own resource, for example https://your-resource.openai.azure.com, and the model field refers to the deployment name you created in Azure, not the underlying model ID. The classic API also requires an api-version query parameter and sends the key in an api-key header rather than as a bearer token. Azure has introduced a newer v1 API path that is closer to standard OpenAI clients. Apps with an explicit Azure option handle these details; with a generic OpenAI-compatible option, use Azure's v1 endpoint if your resource supports it.

Anthropic

Anthropic's native Messages API is not OpenAI-compatible: it uses an x-api-key header, an anthropic-version header and its own request format. Anthropic offers an OpenAI SDK compatibility endpoint for testing, but features such as prompt caching are best used through the native API. Prefer apps with direct Anthropic support, or route through OpenRouter or a gateway.

Gateways

A self-hosted gateway such as LiteLLM exposes one OpenAI-compatible base URL and translates requests to many providers, including Anthropic. Teams use gateways to issue virtual keys, set budgets, apply rate limits and log token usage in one place.

Our picks

These tools help you run or route OpenAI-compatible endpoints.

See local AI with Ollama and OpenRouter explained for setup details, or filter the directory by Local models.

Editorial independence: rankings are based on our own testing and research. Some outbound links may in future be affiliate links; that never affects scores. See our editorial policy.

Get the BYOK Brief

New listings, price changes and model releases. Fortnightly.

Fortnightly: new listings, price changes and model releases. Unsubscribe at any time.