CQTAI
Chat

OpenAI Protocol (GPT)

OpenAI Chat Completions / Responses compatible. For GPT, plus DeepSeek, GLM, etc.

Endpoints

UsageMethodPath
Chat (REST + SSE)POST/v1/chat/completions
Codex (Responses)POST/v1/responses
Model listGET/v1/models

Authentication

Authorization: Bearer <API_KEY>
Content-Type: application/json

Supported Models

gpt-* (e.g. gpt-4o), deepseek-*, glm-* (e.g. glm-5.2), etc. See GET /v1/models.

Request Parameters

ParamTypeRequiredDescription
modelstringRequiredModel, e.g. gpt-4o
messagesarrayRequiredMessages (role/content)
streambooleantrue for SSE; add stream_options.include_usage=true to get usage
temperature / top_pnumberSampling controls
max_tokens / max_completion_tokensintegerMax output
tools / tool_choiceTool calling

Streaming (SSE)

Set "stream": true and "stream_options": {"include_usage": true}; receive SSE with curl -N. Events data: {chunk}, ends with data: [DONE]; usage in the final chunk.

Request Example

Non-streaming

curl -X POST "https://api.cqtai.com/v1/chat/completions" \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role":"user","content":"你好,介绍一下你自己"}]
  }'

Streaming (SSE with usage)

curl -N -X POST "https://api.cqtai.com/v1/chat/completions" \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "stream": true,
    "stream_options": {"include_usage": true},
    "messages": [{"role":"user","content":"写一首关于夏天的短诗"}]
  }'

Response Example

{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "model": "gpt-4o",
  "choices": [
    { "index": 0, "message": { "role": "assistant", "content": "你好!……" }, "finish_reason": "stop" }
  ],
  "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 }
}
Image Generation

Image Generation (GPT-Image · sync)NEW

Beyond chat, the same OpenAI protocol also offers synchronous image generation: a single request returns the image (url or b64_json) directly — no taskId, no polling. Developers already using an OpenAI SDK / images client can integrate as-is.

Endpoints

UsageMethodPath
Text-to-imagePOST/v1/images/generations
Image edit (multipart)POST/v1/images/edits
Variations (multipart)POST/v1/images/variations

Supported Models

gpt-image-1 / gpt-image-1.5 / gpt-image-2 (all 6 credits/img).

Request Parameters

ParamTypeRequiredDescription
modelstringRequiredgpt-image-1 / gpt-image-1.5 / gpt-image-2 (all 6/img)
promptstringRequiredImage description
nintegerNumber of images; billed x n when >1, default 1
sizestringOutput size (official pixels, default 1024x1024)
qualitystringQuality: low / medium / high / auto
response_formatstringurl or b64_json (gpt-image-1 often returns b64_json)

Billing & Credits

gpt-image-1 / gpt-image-1.5 / gpt-image-2 are all 6 credits/img x n.
⚠ Pricing differs from the async Sora image channel (POST /api/cqt/generator/sora): here gpt-image-1 / 1.5 / 2 are all 6/img; the async sora channel is 4 / 6 / 12. Image-to-image / variations use multipart /v1/images/edits and /v1/images/variations.

Request Example

Text-to-image (sync)

curl -X POST "https://api.cqtai.com/v1/images/generations" \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "a red panda astronaut, studio lighting",
    "n": 1,
    "size": "1024x1024"
  }'

Response Example

{
  "created": 1710000000,
  "data": [
    { "url": "https://.../image.png" }
  ]
}

Billing & Credits

Billed per token: input × input price + output × output price (cache write ×1.25, cache read ×0.1), then × your rate. count_tokens is free. See the Intro page for model prices.