OpenAI-compatible API
An OpenAI-compatible API is the inference endpoint that mimics OpenAI's HTTP shape (`/v1/chat/completions`, `messages` format, streaming SSE) so client code written for OpenAI works without changes — Groq, Fireworks, Together, OpenRouter, vLLM, llama.cpp all ship OpenAI-compatible endpoints.
OpenAI's API shape became the de-facto standard in 2023-2024; by 2026 almost every hosted inference platform offers an OpenAI-compatible endpoint. Benefits: switching vendors is one URL + API key change; existing SDK code, libraries (Vercel AI SDK, LiteLLM, OpenRouter, Cursor, Cline) all 'just work'; new models drop into existing eval pipelines without code change. Trade-offs: vendor-specific features (Anthropic prompt caching, Google grounding, native tool formats) require non-compatible APIs to expose; compatibility shims sometimes lag the latest OpenAI API additions (parallel tool calls, structured outputs strict mode). For production stacks needing portability, prioritize OpenAI-compatible vendors — switching cost drops by orders of magnitude.
When to use openai-compatible api
- Any production stack needing vendor portability.
Common mistakes
- Assuming full feature parity — some advanced features don't translate.
FAQ
What is openai-compatible api?
An OpenAI-compatible API is the inference endpoint that mimics OpenAI's HTTP shape (`/v1/chat/completions`, `messages` format, streaming SSE) so client code written for OpenAI works without changes — Groq, Fireworks, Together, OpenRouter, vLLM, llama.cpp all ship OpenAI-compatible endpoints.
When should I use openai-compatible api?
Any production stack needing vendor portability.
What are the most common mistakes with openai-compatible api?
Assuming full feature parity — some advanced features don't translate.
Related terms
- AI SDK — An AI SDK is the official client library a vendor ships for calling their model APIs — Anthropic SDK, OpenAI SDK, Google GenAI SDK, Mistral SDK, Vercel AI SDK (multi-vendor wrapper). Handles auth, retries, streaming, types.
- LLM gateway — An LLM gateway is the proxy layer between your app and one-or-many LLM providers — handles routing, fallback, caching, cost tracking, rate limiting, and observability. OpenRouter, LiteLLM, Portkey, Helicone, Cloudflare AI Gateway are 2026 leaders.
- Model name portability — Model name portability is the principle of writing app code that survives swapping the underlying LLM provider (Claude → GPT → Gemini → local) without rewriting prompts, tool definitions, or response parsing.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/openai-compatible-api.md.