What is an OpenAI-compatible API? Change one base_url to switch providers
An OpenAI-compatible API keeps OpenAI's paths and request format, so the official SDKs, LangChain, Dify, n8n and other tools connect by changing base_url and the key. Which endpoints this site supports, how to migrate, and how compatible and native APIs differ.
An OpenAI-compatible API is one whose paths and request format match the OpenAI API, such as POST /v1/chat/completions. Tutujin API's OpenAI-compatible address is https://open.tutujin.com/v1. Code that already uses an OpenAI SDK needs two changes, base_url and api_key, to call GPT, Claude, Gemini, DeepSeek and every other model the catalog lists for that endpoint; set model to the model you want.
Why everyone supports the OpenAI format
The OpenAI format has the most users and the most tooling. The official Python and Node.js SDKs, LangChain, LlamaIndex, Dify, FastGPT and n8n all accept a custom base URL, so any service that speaks this format works with all of them out of the box. For a business, switching providers or models then needs no change to application code.
Endpoints on this site
| Endpoint | Method and path | Status | Models |
|---|---|---|---|
| Chat Completions | POST/v1/chat/completions | Verified | 681 |
| Responses | POST/v1/responses | Relayed as-is | 5 |
| Claude Messages | POST/v1/messages | Verified | 49 |
| Gemini generateContent | POST/v1beta/models/{model}:generateContent | Verified | 63 |
| Image generation | POST/v1/images/generations | Relayed as-is | 54 |
| Image editing | POST/v1/images/edits | Relayed as-is | 31 |
| Embeddings | POST/v1/embeddings | Verified | 18 |
| Rerank | POST/v1/rerank | Relayed as-is | 6 |
| Text to speech | POST/v1/audio/speech | Relayed as-is | 8 |
| Speech to text | POST/v1/audio/transcriptions | Relayed as-is | 1 |
"Verified" means we have made real calls and checked billing on this site. "Relayed as-is" means requests are forwarded in their original format; parameters follow the model's official documentation. Model counts are the models in the current catalog that support the endpoint.
"Verified" endpoints have been called for real on this site with billing checked. Endpoints "relayed as-is" pass requests to the model service in their original format, and parameters follow that model's official documentation.
Migrating in three steps
- Create an API key in the console and pick a group for it.
- Set
base_urltohttps://open.tutujin.com/v1andapi_keyto the new key. - Set
modelto a name from Models and pricing.
The official SDKs also read environment variables, so some projects need no code change at all:
export OPENAI_BASE_URL="https://open.tutujin.com/v1"
export OPENAI_API_KEY="sk-your-key"Or set them explicitly in code:
import os
from openai import OpenAI
client = OpenAI(base_url="https://open.tutujin.com/v1", api_key=os.environ["TUTUJIN_API_KEY"])
resp = client.chat.completions.create(
model="deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Explain context caching in three sentences"}],
)
print(resp.choices[0].message.content)import OpenAI from 'openai'
const client = new OpenAI({ baseURL: 'https://open.tutujin.com/v1', apiKey: process.env.TUTUJIN_API_KEY })
const resp = await client.chat.completions.create({
model: 'deepseek-v4.1-flash',
messages: [{ role: 'user', content: 'Explain context caching in three sentences' }],
})
console.log(resp.choices[0].message.content)Change only model to switch vendors, for example to claude-sonnet-5-5 or gemini-3.8-flash.
Compatible is not identical
- Parameter support varies. The range of
temperature,response_format,toolsandreasoning_effortare supported to different degrees by non-OpenAI models. An unsupported parameter may be ignored or may return a 400. - Some response fields differ. The basic structure is the same, but vendor-specific details such as reasoning content or cached tokens depend on the model, both in field name and in whether they are returned.
- Use this site's model names. The same model can be named differently on different platforms; the model hub is the reference.
So after switching models, check parameters and responses with a few requests before sending real traffic.
Compatible or native?
| Your situation | Use |
|---|---|
| New project, switching between vendors | The OpenAI-compatible API, one code path for everything |
Existing Anthropic SDK code, or you need Claude's native parameters such as cache_control | The native Claude Messages API |
| Existing Google Gen AI SDK code | The native Gemini API |
| LangChain, Dify, n8n and similar tools | Pick the OpenAI or OpenAI-compatible provider type and fill in base_url and the key |
All three use the same key and the same prices.
Tool setup guides
- OpenAI SDK
- Anthropic SDK
- LangChain and LlamaIndex
- Dify, FastGPT and n8n
Header formats and authentication options are in Authentication and base URL.
FAQ
Can the OpenAI-compatible API call Claude and Gemini?
Yes. Claude and Gemini models that the catalog lists for Chat Completions work in the OpenAI format. When you need Claude's or Gemini's native parameters, use their native APIs instead; the same key works for all of them.
Is changing base_url enough?
Also replace api_key with a key from this site and set model to a name from the model hub. The rest of your application code usually stays the same.
Should base_url include /v1?
For the OpenAI SDK, set base_url to https://open.tutujin.com/v1, which includes /v1. For the Anthropic SDK and the Google Gen AI SDK, use the site root https://open.tutujin.com; they append the rest of the path themselves.
Is streaming supported?
Yes. Streaming on Chat Completions has been verified on this site and works as it does with OpenAI; set stream to true in the request.