Create Chat Completion (Chat Completions)
/v1/chat/completionsGenerate a reply from conversation messages with Nex N2.6. Authenticate with Authorization: Bearer <API Key> and send an application/json request body.
Production HTTP requests use https://api.mosi.cn. Before running the examples below, set MOSS_API_ORIGIN to https://api.mosi.cn and MOSS_API_KEY to your MOSS API Key. Set the OpenAI SDK base_url to https://api.mosi.cn/v1.
Request parameters
Use nex-n2.6. To pin a version, use nex-n2.6-2026-11-05.
Conversation messages. For a text-only request, send one message with role set to user. To continue a conversation, include the relevant history.
Use a string for text. For text with images, send content items with text and image_url. Use video_url for MP4 or WebM video.
Output token budget. The production default is 8,192 and the maximum is 131,072. Specify either this field or max_completion_tokens.
Compatibility alias for max_tokens. Specify either this field or max_tokens.
Set to true to stream the response.
Set to true on a streaming request to receive usage at the end of the stream.
Supports function tools executed by the client. Server-hosted tools are unavailable.
Accepts enabled. disabled is currently unsupported.
Set to json_object to request a JSON object reply.
Use auto to let the model choose a tool, none to disable structured tool calls, or an object to select a function.
Optional. If supplied, use 2026-11-05 and make sure it matches the snapshot selected by model.
Set image_url.url to a public HTTPS URL or a complete Base64 data URL. Use video_url for MP4 or WebM video. Public media URLs must be accessible to MOSS. The entire request body, including encoded media, must be at most 10 MiB. Files, file_id, and asset library references are currently unsupported.
Response fields
The model snapshot used to generate the response.
Final text. This may be empty if reasoning consumes the entire output budget.
Structured tool calls for the client to execute.
stop indicates natural completion, length indicates that the output budget was reached, and tool_calls indicates that the model generated tool calls.
Read prompt_tokens, completion_tokens, and total_tokens. Cached input usage is in prompt_tokens_details.cached_tokens. Reasoning usage is in completion_tokens_details.reasoning_tokens.
Reasoning and final replies
Read the final reply from choices[].message.content. If the assistant message for a tool call contains reasoning_content, preserve it when sending back the tool result. thinking.type accepts enabled. Setting it to disabled returns HTTP 400 with invalid_field_value.
Client integration
Set the OpenAI SDK base_url to https://api.mosi.cn/v1. In streaming responses, handle text, finish reasons, and usage separately. Check whether choices is empty before reading it.