Console

Create Chat Completion (Chat Completions)

POST/v1/chat/completions

Generate 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

FieldTypeUsageDescription
model: stringRequired

Use nex-n2.6. To pin a version, use nex-n2.6-2026-11-05.

messages: array<object>Required

Conversation messages. For a text-only request, send one message with role set to user. To continue a conversation, include the relevant history.

messages[].content: string or arrayDepends on the message type

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.

max_tokens: integerOptional

Output token budget. The production default is 8,192 and the maximum is 131,072. Specify either this field or max_completion_tokens.

max_completion_tokens: integerOptional

Compatibility alias for max_tokens. Specify either this field or max_tokens.

stream: booleanOptional

Set to true to stream the response.

stream_options.include_usage: booleanOptional

Set to true on a streaming request to receive usage at the end of the stream.

tools: array<object>Optional

Supports function tools executed by the client. Server-hosted tools are unavailable.

thinking.type: stringOptional

Accepts enabled. disabled is currently unsupported.

response_format.type: stringOptional

Set to json_object to request a JSON object reply.

tool_choice: string or objectOptional

Use auto to let the model choose a tool, none to disable structured tool calls, or an object to select a function.

version: stringOptional

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

FieldTypeDescription
model: string

The model snapshot used to generate the response.

choices[].message.content: string

Final text. This may be empty if reasoning consumes the entire output budget.

choices[].message.tool_calls: array<object>

Structured tool calls for the client to execute.

choices[].finish_reason: string

stop indicates natural completion, length indicates that the output budget was reached, and tool_calls indicates that the model generated tool calls.

usage: object

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.