Skip to main content

Migrating from OpenAI to Turing

If your code already uses the OpenAI Python / Node.js / Java SDK, migration typically requires just two changes: base_url and api_key. Below are the minimal diffs and common migration scenarios.

Core diff (Python)

from openai import OpenAI

client = OpenAI(
- api_key=os.environ["OPENAI_API_KEY"],
+ api_key=os.environ["TURING_API_KEY"],
+ base_url="https://live-turing.cn.llm.tcljd.com/api/v1",
)

Node.js

import OpenAI from "openai";

const client = new OpenAI({
- apiKey: process.env.OPENAI_API_KEY,
+ apiKey: process.env.TURING_API_KEY,
+ baseURL: "https://live-turing.cn.llm.tcljd.com/api/v1",
});

cURL

-curl https://api.openai.com/v1/chat/completions \
+curl https://live-turing.cn.llm.tcljd.com/api/v1/chat/completions \
- -H "Authorization: Bearer $OPENAI_API_KEY" \
+ -H "Authorization: Bearer $TURING_API_KEY" \
-H "Content-Type: application/json" \
-d '{...}'

That's it. The rest of your code (messages, tools, stream, response_format, etc.) requires no changes.


Choosing a model name

OpenAI model names on the Turing Platform require a turing/ prefix. The examples below prioritize models recommended for use in the past 6 months; for legacy model migration, refer to the availability status in Model List / Chat:

OpenAI nameTuring Platform name
gpt-5.6 / gpt-5.6-solturing/gpt-5.6-sol
gpt-5.6-terraturing/gpt-5.6-terra
gpt-5.6-lunaturing/gpt-5.6-luna
gpt-5.5turing/gpt-5.5
gpt-5.4turing/gpt-5.4
gpt-5.4-minituring/gpt-5.4-mini
gpt-5.4-nanoturing/gpt-5.4-nano
text-embedding-3-smallturing/text-embedding-3-small

The Turing Platform also supports cross-vendor models (calling Claude / Gemini / Qwen with the same OpenAI SDK). These model names do not carry the turing/ prefix — for example, claude-sonnet-5 or qwen-plus-latest. See the full list at Model List / Chat.

The GPT-5.6 series provides additional compatibility aliases: bare gpt-5.6 routes to the flagship Sol variant, and bare gpt-5.6-sol / terra / luna also route to their corresponding turing/ models. New code should still use the full platform model ID explicitly to keep logs and configuration consistent.


Feature compatibility matrix

FeatureOpenAI nativeTuring Platform
Chat Completions✅ Fully compatible
Responses API✅ (see OpenAI Responses)
Note: Built-in tools code_interpreter / file_search / web_search are not supported — use functions or MCP instead
Streaming SSE
Function calling / Tool use
Structured Output (response_format)
Vision / Multimodal✅ (image + audio + video + file)
Assistants / Threads⚠ Turing Assistant is planned; for now use Chat Completions + manage state yourself
Embeddings
Images✅ (/v1/images/generations, /edits, /scales)
Audio Speech (TTS)
Audio Transcriptions (STT)✅ (async task model, see STT)
Realtime✅ (WebSocket)
Fine-tuning❌ Not available
Batch API⚠ Not publicly available

Turing addition: turing_options

After migrating, you can add a top-level turing_options field to access platform capabilities:

response = client.chat.completions.create(
model="turing/gpt-5.4-mini",
messages=[...],
extra_body={
"turing_options": {
"timeout": 30,
"max_retries": 2,
"fallbacks": ["turing/claude-sonnet-5"]
}
}
)
FieldDescription
timeoutServer-side timeout (0–300s)
max_retriesNumber of automatic retries (1–3), applies only to 429/5xx/timeout errors
fallbacksAutomatically switch to a fallback model if the primary model fails

See Timeout, Retry, and Fallback for details.


Common gotchas

  • Model name prefix: Missing the turing/ prefix for most models returns a 404; the GPT-5.6 series has compatibility aliases configured for bare model names, and cross-vendor models like claude-* and gemini-* do not require this prefix.
  • Assistants API: Currently not supported. Assistants code must be refactored to use Chat Completions + local state management.
  • top_logprobs: Not returned by some vendors (non-OpenAI).
  • logit_bias: Ignored by some smaller models.
  • web_search built-in tool in Responses: Not supported on Turing — use custom tools functions + the dedicated web search endpoint instead.
  • OpenAI SDK default timeout: The client also has a timeout; it is recommended to set OpenAI(timeout=60) explicitly, longer than turing_options.timeout.

Platform capabilities available immediately after migration

  • Cross-vendor model switching: Change only the model name in the same code to switch from GPT to Claude / Gemini / Qwen.
  • Fallback chain: Automatically switches to a backup model when the primary model returns 429.
  • Unified billing: View spending across all vendors in one dashboard at Billing & Usage.
  • Request tracing: X-Turing-Trace-Id provides consistent traceability for debugging.
  • Prompt caching: Claude's cache_control works here too, reducing input costs by up to 90%.

See also