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. For ordinary Chat Completions requests, the rest of your code (messages, tools, stream, response_format, etc.) requires no changes. For the GPT-6 series (Astra / Sol / Luna), use the Responses API for reasoning and tool calls and follow the parameter limits below.


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-6-astraturing/gpt-6-astra
gpt-6-solturing/gpt-6-sol
gpt-6-lunaturing/gpt-6-luna
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-6 series provides compatibility aliases: bare gpt-6-astra / gpt-6-sol / gpt-6-luna route to their corresponding turing/ models. The GPT-5.6 series also provides 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)
GPT-6 Astra supports the native web_search tool; use functions or MCP for other built-in tools
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-6 series (bare gpt-6-astra / gpt-6-sol / gpt-6-luna) and GPT-5.6 have compatibility aliases configured, while bare gpt-6 is unavailable. Cross-vendor models like claude-* and gemini-* do not require this prefix.
  • GPT-6 parameters: Use Responses for tools with GPT-6 Astra / Sol / Luna; do not send temperature, top_p, or log probabilities. Set reasoning intensity with reasoning.effort: low / medium / high / xhigh / max.
  • 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: GPT-6 Astra supports it; see Web Search → GPT-6 Astra. For other models, use custom tools functions + the dedicated endpoint.
  • 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​