POST/v1/chat/completions

Create a model response for a chat conversation.

POSThttps://api.000labs.xyz/v1/chat/completions

Generates the next assistant message for a conversation. Fully compatible with the OpenAI Chat Completions API, so existing SDKs work unchanged.

Request body

modelstringrequired

Model ID such as anthropic/claude-3.5-sonnet.

messagesarrayrequired

The conversation so far.

roleenumrequired

system, user, assistant or tool.

contentstring | arrayrequired

Text, or an array of text and image_url parts for vision models.

tool_call_idstringoptional

Required when role is tool.

streambooleanoptionaldefault: false

Stream tokens as server-sent events. See Streaming.

temperaturenumberoptionaldefault: 1

0–2. Higher values give more random output.

max_tokensintegeroptionaldefault: model max

Maximum tokens to generate in the reply.

See Parameters & Schema for every supported field.

Response

idstringrequired

Unique identifier for the completion.

modelstringrequired

The 000 Labs model ID that served the request.

choicesarrayrequired

Generated messages.

messageobjectrequired

The assistant message with role and content (and tool_calls when tools are used).

finish_reasonstringrequired

stop, length, tool_calls or content_filter.

usageobjectrequired

Token counts used for billing: prompt_tokens, completion_tokens, total_tokens.