Skip to content
TutujinAPI

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://www.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

EndpointMethod and pathStatusModels
Chat CompletionsPOST/v1/chat/completionsVerified681
ResponsesPOST/v1/responsesRelayed as-is5
Claude MessagesPOST/v1/messagesVerified49
Gemini generateContentPOST/v1beta/models/{model}:generateContentVerified63
Image generationPOST/v1/images/generationsRelayed as-is54
Image editingPOST/v1/images/editsRelayed as-is31
EmbeddingsPOST/v1/embeddingsVerified18
RerankPOST/v1/rerankRelayed as-is6
Text to speechPOST/v1/audio/speechRelayed as-is8
Speech to textPOST/v1/audio/transcriptionsRelayed as-is1
MidjourneyPOST/mj/submit/imagineRelayed as-is13
Suno musicPOST/suno/submit/musicRelayed as-is2

"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

  1. Create an API key in the console and pick a group for it.
  2. Set base_url to https://www.tutujin.com/v1 and api_key to the new key.
  3. Set model to a name from Models and pricing.

The official SDKs also read environment variables, so some projects need no code change at all:

cURL
export OPENAI_BASE_URL="https://www.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://www.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)

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, tools and reasoning_effort are 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. For moving a whole project from the official APIs or another service, the checklist, staged rollout and rollback are in How to migrate from the official APIs or another OpenAI-compatible service.

Compatible or native?

Your situationUse
New project, switching between vendorsThe OpenAI-compatible API, one code path for everything
Existing Anthropic SDK code, or you need Claude's native parameters such as cache_controlThe native Claude Messages API
Existing Google Gen AI SDK codeThe native Gemini API
LangChain, Dify, n8n and similar toolsPick 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

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://www.tutujin.com/v1, which includes /v1. For the Anthropic SDK and the Google Gen AI SDK, use the site root https://www.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.