What is an OpenAI-compatible API?
OpenAI-compatible API — an API that accepts and returns requests in the same wire format as OpenAI's /v1/chat/completions endpoint, so any application using the OpenAI SDK (Python, TypeScript, Go, etc.) can switch to it by changing only the base_url and api_key — no other code change.
Why this is a de facto industry standard
When OpenAI shipped /v1/chat/completions in 2023, the SDK and request shape became the most-integrated API contract in machine-learning history within months. Every framework that needed to call an LLM (LangChain, LlamaIndex, the Vercel AI SDK, every agent framework) targeted that shape. By 2026, "OpenAI-compatible" describes the wire contract more than it describes the vendor.
Every major non-OpenAI provider now offers an OpenAI-compatible mode in addition to their native API. Anthropic, Google, Mistral, Groq, DeepSeek, xAI, and Amazon Bedrock (via Converse-OpenAI) all accept the same chat completions shape. This is what makes LLM gateways possible — one shape on the customer side, N shapes on the provider side, the gateway translates.
What the wire contract covers
- POST
/v1/chat/completions— messages array with role (system, user, assistant, tool), content (string or array of typed parts for images), optional name, optional tool_call_id, optional tool_calls. - Streaming via Server-Sent Events when
stream: trueis set. Each event isdata: {...}followed bydata: [DONE]. - Tool calling via
tools(array of function descriptors) andtool_choice(auto, none, or required). Tool-result messages carry roletooland atool_call_id. - Structured output via
response_format— either{ type: 'json_object' }or{ type: 'json_schema', json_schema: ... }. - Sampling controls —
temperature,top_p,max_tokens(ormax_completion_tokensfor newer models),stop,seed. - Response shape —
id,object: 'chat.completion',created(unix seconds),model,choices(withmessage.content, optionaltool_calls),usagewith prompt_tokens / completion_tokens / total_tokens.
How GammaInfra is OpenAI-compatible
GammaInfra's /v1/chat/completions accepts every field documented above. The only code change required to migrate is the base_url:
Before (OpenAI direct):
from openai import OpenAI
client = OpenAI(
api_key="sk-proj-...",
base_url="https://api.openai.com/v1",
)
After (GammaInfra):
from openai import OpenAI
client = OpenAI(
api_key="sk-gammainfra-...",
base_url="https://api.gammainfra.com/v1",
)
Every subsequent client.chat.completions.create(...) call works as-is. Streaming works. Tool calling works. Structured output works. The same code path handles all 8 underlying providers because the GammaInfra gateway translates internally.
Common questions
What does 'OpenAI-compatible' actually mean?
/v1/chat/completions and returns responses in the same JSON shape. Same field names, same nesting, same enum values. SDK code that was working against api.openai.com works against an OpenAI-compatible endpoint after a single base_url change.Does OpenAI-compatible mean fully feature-equivalent?
Why do gateways implement OpenAI-compat instead of inventing their own format?
Are there gotchas when migrating from native OpenAI to OpenAI-compatible?
max_completion_tokens instead of max_tokens, and rejects temperature != 1. Gateways usually translate these silently. Check the gateway's docs for any rejected fields.Can I use the Anthropic SDK against an OpenAI-compatible endpoint?
/v1/messages format, which has a different request and response shape. You can either use the OpenAI SDK against an OpenAI-compatible endpoint or use the Anthropic SDK against an Anthropic-native endpoint. Some gateways (including GammaInfra at present) only expose the OpenAI-compatible surface; Anthropic-native ingress is a separate compatibility layer that's not universal.Try the gateway
$3 free trial credit on signup, $10 minimum top-up. Pass-through provider rates plus 3% top-up fee during the launch window (5% after 2026-06-23).
Last updated 2026-05-15.