API Reference
Chat Completions

Chat Completions

POST https://routify.bytedance.city/v1/chat/completions

OpenAI-compatible. Drop-in replacement for api.openai.com.

Request

POST /v1/chat/completions
Authorization: Bearer rtf_xxx
Content-Type: application/json
 
{
  "model": "deepseek-v3.2",
  "messages": [
    {"role": "system", "content": "You are concise."},
    {"role": "user", "content": "Capital of France?"}
  ],
  "temperature": 0.3,
  "max_tokens": 256,
  "stream": false
}

Parameters

ParamTypeDefaultNotes
modelstringrequiredModel name (see Models) or routify-auto
messagesarrayrequiredOpenAI-style messages
temperaturenumber10–2, lower = more deterministic
top_pnumber1Alternative to temperature
max_tokensintmodel maxHard cap on completion
streamboolfalseSSE streaming
stopstring | arraynullStop sequences
toolsarrayFunction calling (see Quickstart)
tool_choicestring | objectautoForce a specific tool
response_formatobject{"type": "json_object"} for JSON mode
extra_body.routifyobjectRoutify-specific opts (region, task)

Response

{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "created": 1747836000,
  "model": "deepseek-v3.2",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Paris."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 14,
    "completion_tokens": 2,
    "total_tokens": 16
  },
  "routify": {
    "channel": "deepseek-official",
    "latency_ms": 187,
    "cost_usd": 0.0000028
  }
}

Streaming

Set stream: true. Each line is data: <json> SSE:

data: {"id":"...","choices":[{"delta":{"content":"Hello"}}]}
data: {"id":"...","choices":[{"delta":{"content":" world"}}]}
data: [DONE]

Errors

CodeReason
400Invalid request body
401Missing / invalid API key
402Insufficient balance
403Account suspended / model not allowed for tier
429Rate limit
500Internal error
502All upstream channels failed
503Maintenance