Knowledge base

Tìm nhanh trong tài liệu Zora

Chat Completions

Create a chat completion using a supported Zora GPT/Codex model. This endpoint is compatible with the OpenAI Chat Completions API.

POST/v1/chat/completions

Request Body

ParameterTypeRequiredDescription
modelstringYesModel ID to use, such as gpt-5.5 or gpt-5.4-mini
messagesarrayYesList of message objects
effortstringNoReasoning effort for text models: low, medium, high, or xhigh
reasoning_effortstringNoAlias for effort
temperaturenumberNoSampling temperature (0-2)
max_tokensintegerNoMaximum tokens to generate
streambooleanNoEnable streaming response
top_pnumberNoNucleus sampling parameter

Example Request

curl for macOS / Linux / Git Bash
curl https://api.zora.io.vn/v1/chat/completions \ -H "Authorization: Bearer YOUR_ZORA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.5", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is machine learning?"} ], "effort": "medium", "temperature": 0.7, "max_tokens": 1000, "stream": false }'
Windows PowerShell
$body = @{ model = "gpt-5.5" messages = @( @{ role = "system"; content = "You are a helpful assistant." } @{ role = "user"; content = "What is machine learning?" } ) effort = "medium" temperature = 0.7 stream = $false } | ConvertTo-Json -Depth 5 Invoke-WebRequest ` -Uri "https://api.zora.io.vn/v1/chat/completions" ` -Method POST ` -Headers @{ Authorization = "Bearer YOUR_ZORA_API_KEY" } ` -ContentType "application/json" ` -Body $body
Model access
A 401 invalid_api_key response means the key is missing, mistyped, masked, revoked, or from an older disabled key. First verify the same key with GET /v1/models. A403 model_not_allowed response means the key is valid, but the selected model is not enabled on that plan. Start with gpt-5.5 or another model listed inModels for the account tier.

Response

JSON
{ "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1710000000, "model": "gpt-5.5", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Machine learning is a subset of AI..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 25, "completion_tokens": 150, "total_tokens": 175 } }

Streaming

Set stream: true to receive responses as Server-Sent Events (SSE). Each chunk contains a delta object with the incremental content:

SSE Stream
data: {"id":"chatcmpl-abc123","choices":[{"delta":{"content":"Machine"}}]} data: {"id":"chatcmpl-abc123","choices":[{"delta":{"content":" learning"}}]} data: {"id":"chatcmpl-abc123","choices":[{"delta":{"content":" is"}}]} ... data: [DONE]