Operations
OpenAI - chat completion
const url = 'https://coder.api.visioncoder.cn/v1/chat/completions';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"model":"gpt-5.4","messages":[{"role":"system","content":"Hello","name":"example","tool_call_id":"example"}],"temperature":1,"top_p":1,"n":1,"max_tokens":4096,"max_completion_tokens":1,"stream":false,"stop":"example","presence_penalty":1,"frequency_penalty":1,"seed":1,"response_format":{"type":"text"},"tools":[{}],"tool_choice":"example","user":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://coder.api.visioncoder.cn/v1/chat/completions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "gpt-5.4", "messages": [ { "role": "system", "content": "Hello", "name": "example", "tool_call_id": "example" } ], "temperature": 1, "top_p": 1, "n": 1, "max_tokens": 4096, "max_completion_tokens": 1, "stream": false, "stop": "example", "presence_penalty": 1, "frequency_penalty": 1, "seed": 1, "response_format": { "type": "text" }, "tools": [ {} ], "tool_choice": "example", "user": "example" }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”OpenAI Chat Completions request body. The platform forwards it upstream as-is; fields follow the official OpenAI protocol.
object
Model ID. Accepts any chat-capable model returned by GET /v1/models — e.g. OpenAI gpt-5.4 / gpt-5.5, Anthropic claude-sonnet-5 / claude-opus-5, or open-source deepseek-v4-pro / qwen3.6-35b-a3b / kimi-k2.6 / glm-5.1 / glm-5.2 / minimax-m2.7.
Example
gpt-5.4Conversation message list
object
Example
userExample
HelloExample
0.7Number of candidate completions to generate
Maximum output tokens
Example
4096Newer field, equivalent to max_tokens
Whether to stream the response via SSE
Stop sequence(s); string or array of strings
object
Function-calling tool definitions
object
Tool choice strategy; string or object
End-user identifier
Responses
Section titled “Responses”A successful response.
OpenAI Chat Completions response body. Fields follow the official OpenAI protocol.
object
object
object
object
object
object
Example
{ "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1730000000, "model": "gpt-5.4", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 28, "total_tokens": 40 }}