April 15, 20263 min readGuide

What is an OpenAI-compatible API and why it matters

When developers say an API is "OpenAI-compatible," they mean it speaks the same HTTP dialect that OpenAI popularized: the same /v1/chat/completions route, the same JSON request shape with a messages array and a model field, the same streaming format, and the same Authorization: Bearer header. Because that shape became a de facto standard, almost every SDK, framework, and coding tool already knows how to talk to it.

Why a shared shape is useful

The value isn't the format itself — it's what the format unlocks. Any client built for OpenAI can point at a different server simply by changing two things: the base_url and the API key. No new SDK, no rewrite of your request-building code, no relearning how streaming chunks arrive.

That portability matters for three concrete reasons:

  • Less lock-in. Your code isn't welded to one vendor. If pricing, latency, or quality changes, you move by editing config.
  • One integration, many models. A single compatible gateway can route to models from several providers, so you stop maintaining a separate client per vendor.
  • Tooling reuse. Cursor, Aider, Continue, Cline, and CLI agents all accept a custom OpenAI-compatible endpoint, so they work without bespoke plugins.

What "compatible" really covers

Compatibility is mostly about the request and response envelope, not every feature. The core surface that almost always works:

Feature Typically supported
chat/completions endpoint Yes
messages roles (system/user/assistant) Yes
stream: true token streaming Yes
Authorization: Bearer <key> Yes
Model selection via model id Yes
Provider-specific extras (some tool formats, modalities) Varies

The lesson: lean on the common core for portability, and treat provider-specific extensions as nice-to-haves you can detect and degrade gracefully.

How AnyModel uses this

AnyModel is one OpenAI-compatible endpoint that fronts many providers at once. The base URL is https://anymodel.org/v1, and a single API key reaches GPT, Claude, Gemini, DeepSeek, GLM, Kimi, Qwen, and Grok. To switch models you change the model id and nothing else — same key, same URL, same code path.

Here's the entire integration with curl:

curl https://anymodel.org/v1/chat/completions \
  -H "Authorization: Bearer $ANYMODEL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Want a different model? Replace "gpt-5" with "claude-opus-4-8", "gemini-2.5-pro", or "deepseek-v3". That's the whole point of compatibility: the diff is one string.

If you use a supported CLI tool (codex, claude, opencode, or hermes), one line wires it up:

bash <(curl -fsSL "https://anymodel.org/i?tool=codex") <YOUR_API_KEY>

Use tool=claude for Claude Code. For editors like Cursor, Windsurf, Zed, Cline, Aider, Continue, or Gemini CLI, do a manual OpenAI-compatible setup: set the base URL to https://anymodel.org/v1 and paste your key.

When compatibility pays off

The real-world win shows up during evaluation. Instead of building three integrations to compare three models, you build one and loop over model ids. You can compare models side by side on your own prompts, measure cost and quality, and pick winners per task — a cheap model for classification, a frontier model for hard reasoning — all without touching your transport layer.

A note on privacy, because it interacts with how these APIs work: the destination model provider always receives your prompt to generate a response, so no gateway can promise "100% privacy." What we do offer is Ghost Mode, an opt-in setting where AnyModel doesn't store your prompts or responses on our side — only a token counter for billing. It's honest about the boundary: zero retention on our infrastructure, not a magic shield over the upstream model.

Getting started

An OpenAI-compatible API matters because it turns model choice into a configuration decision instead of an engineering project. You write once and stay free to move.

You can try it without a credit card: signing up gives you 1,000,000 free tokens, and 6,000,000 total if you link Telegram. After that it's pay-per-token — no subscription, no minimums. Browse more guides on the blog when you're ready to go deeper.

Create your free account and send your first request in minutes.

Read next