Chat Completions API
The OpenAI-compatible /v1/chat/completions endpoint is the primary model invocation entry point on the Turing Platform. Models from all major providers—OpenAI, Claude, Gemini, Qwen, DeepSeek, Zhipu, ByteDance, KIMI, MiniMax, Bedrock, and more—can be called through this single protocol by simply switching the model field.
Parameter schema, response schema, multi-language code samples, and an interactive Try-It console: Create chat completion →
This page focuses on usage scenarios and cross-provider capability differences; it does not repeat the schema field dictionary.
Overview
| Item | Details |
|---|---|
| Endpoint | POST /api/v1/chat/completions |
| Protocol compatibility | OpenAI Chat Completions API |
| Primary uses | Chat / function calling / tool use / multimodal input / streaming response / reasoning mode / web search |
| Supported models | Refer to the Model Pricing List; available model IDs are listed by provider |
| Billing | Real-time token-based metering; see Billing & Usage |
When to use this endpoint
- Unified cross-provider entry point: When a single codebase needs to switch between Claude, GPT, and Gemini, this is the preferred choice.
- OpenAI ecosystem tooling: LangChain, LlamaIndex, Autogen, and similar frameworks default to
/v1/chat/completions. - Existing OpenAI SDK code: Only two lines—
api_keyandbase_url—need to change.
Other options:
- Claude-specific capabilities (
cache_controlfine-grained caching,web_search_20250305native tool, thinking block structure) → Anthropic Messages API - GPT-5 stateful reasoning / MCP connector → OpenAI Response API
Capability integrations
The sections below demonstrate concepts only—i.e., what each capability looks like in a request. The complete request body schema, response schema, and multi-language samples are available at /api/create-chat-completion.
Vision (image input)
Multimodal models (GPT-4o / Claude / Gemini / Qwen-VL, etc.) accept image_url or base64 image content:
curl $TURING_BASE_URL/chat/completions \
-H "Authorization: Bearer $TURING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "turing/gpt-5.5",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image"},
{"type": "image_url", "image_url": {"url": "https://.../image.jpg"}}
]
}]
}'
Reasoning mode
- OpenAI / Azure reasoning models (GPT-5, o1/o3/o4): Use
v1/responsesfor controllable reasoning. - Claude 4.6+ / 5.x: Use
extra_body={"thinking": {"type": "adaptive"}, "output_config": {"effort": "high"}}; Opus 4.7/4.8 and Sonnet 5 do not supportenabled/budget_tokens. - Gemini: Use
extra_body={"thinkingConfig": {"includeThoughts": True}}to surface a reasoning summary; omittingthinkingLevel/thinkingBudgetuses the model's default configuration. - Qwen thinking variants / DeepSeek R1: Reasoning is enabled automatically; no flag required.
See Reasoning Model Configuration for details.
Web search
Pass web search configuration via tools / extra_body according to each provider's protocol. The syntax differs across providers:
- Qwen:
extra_body={"enable_search": True} - Gemini:
tools: [{"googleSearch": {}}] - Claude:
tools: [{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}]
See Model Built-in Web Search for details.
Prompt caching
- Claude: Requires explicit
cache_control; see Prompt Caching (Claude). - OpenAI GPT-4o / GPT-5: Cached automatically; no parameters needed.
- Cache hit counts are reported in
usage.prompt_tokens_details.cached_tokensand billed at the corresponding cache-read unit price.
Provider-specific parameters
Use the OpenAI SDK's extra_body to pass any provider-specific, non-standard fields:
curl $TURING_BASE_URL/chat/completions \
-H "Authorization: Bearer $TURING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-max-latest",
"messages": [...],
"enable_search": true,
"thinking": {"type": "adaptive"},
"cache_control": {"type": "ephemeral"}
}'
With cURL, write these fields directly at the top level of the request body. With the Python SDK, use extra_body={...}; with the Java SDK, use putAdditionalBodyProperty; with the TypeScript SDK, use @ts-expect-error or as any to bypass type checking.
turing_options
The Turing Platform extends the OpenAI request body with a turing_options field (placed at the top level of the request body, not inside extra_body) for configuring platform behaviors such as timeouts, retries, and fallback. For field definitions, default values, and allowed ranges, see Timeouts, Retries & Fallback.
See also
- /api/create-chat-completion — Full schema + Try-It
- Billing & Usage — Meaning of
usage/service_usagesfields and reconciliation API - Anthropic Messages API — If you prefer the native Claude protocol
- OpenAI Response API — The new response protocol supported by the GPT-5 series
- Reasoning Model Configuration —
thinkingConfig/reasoning/thinkingfields - Model Built-in Web Search — Web search parameters for each provider
- Prompt Caching (Claude) —
cache_controlusage - Model Pricing List — Unit prices for each model