OpenAI-compatible and Anthropic-compatible APIs, explained
Updated
An OpenAI-compatible or Anthropic-compatible API is one that accepts the same request and response format as OpenAI's or Anthropic's API, so tools built for those APIs work with another model by changing only the base URL, the API key and the model name.
Most SDKs, frameworks and coding agents speak one of these formats, so they can send requests to any server that accepts it.
The three formats
| Format | Endpoint | Used by |
|---|---|---|
| Chat Completions (OpenAI) | POST /v1/chat/completions | Most SDKs, frameworks and agents |
| Responses (OpenAI) | POST /v1/responses | Newer OpenAI SDK features and agents built on them |
| Messages (Anthropic) | POST /v1/messages | Anthropic SDKs and agents built on them |
The official references are the Chat Completions, Responses and Messages docs. A compatible server accepts those request bodies and returns the same fields: choices and usage for Chat Completions, output for Responses, content blocks for Messages.
Switching takes three values
from openai import OpenAI
client = OpenAI(
base_url="https://api.openscale.so/v1",
api_key="YOUR_OPENSCALE_API_KEY",
)
reply = client.chat.completions.create(
model="deepseek/deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)For an Anthropic SDK client, the base URL is https://api.openscale.so/anthropic, and the SDK appends /v1/messages itself. The key and the model name change the same way.
What "compatible" does and does not cover
- Covered: messages, streaming, tool calls, JSON output, usage counts and the error shape of the format.
- Model-specific: each model supports its own set of settings. A good compatible API refuses a value the model cannot take with a clear 400 that names the parameter, instead of ignoring it.
- Provider-specific: hosted tools tied to one company's platform (built-in web search, for example) are not part of the format.
Before you switch, read the target model's limits. On OpenScale, GET /v1/models lists each model's context length, maximum output and supported parameters. DeepSeek V4.1 Flash accepts up to 384,000 output tokens per request and GLM 5.3 Flash up to 131,072.
Coding agents
Coding agents pick one format. Some speak Anthropic Messages, others Chat Completions or Responses. Point the agent at the matching base URL and it runs on an open model with no other change. The setup guide has a tested config for each agent we support.
Questions
Does the OpenAI SDK work with other models?
Yes, with any server that implements the OpenAI API format. Set base_url to the server, use its API key and pass its model name.
Which format should I use?
The one your tool already speaks. For new code, Chat Completions has the widest support across SDKs and frameworks.