Chat Completions
Generate text with the OpenAI-compatible chat interface.
/v1/chat/completionsapi.17.wtfRequest body
| Parameter | Type / requirement | Description |
|---|---|---|
model | string · required | Exact text model ID from the catalog. |
messages | array · required | Conversation messages with role and content. |
max_tokens | integer · optional | Positive output limit; defaults to 4096. |
max_completion_tokens | integer · optional | Alternative output limit; takes precedence over max_tokens. |
temperature | number · optional | Sampling control; accepted range depends on model. |
top_p | number · optional | Nucleus sampling; model dependent. |
stop | string or string[] · optional | Stop sequences. |
stream | boolean · optional | Defaults to false. Use true for SSE. |
tools | array · optional | Function definitions with name, description, parameters. |
tool_choice | string or object · optional | auto, required, none, or a named function. |
reasoning_effort | string · optional | Model-specific effort; reasoning.effort is an alias. |
Messages & content
Supported roles are system, developer, user, assistant, and tool. System and developer messages become the system prompt. Content can be text or an array of text and image_url parts; vision requires a capable model. Image URLs can be HTTPS URLs or base64 data URLs. Assistant tool calls use tool_calls; tool results use the tool role and matching tool_call_id.
Example request
Replace MODEL_ID with a current text model ID.
curl https://api.17.wtf/v1/chat/completions \
-H "Authorization: Bearer $LM0_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID",
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"max_tokens": 512
}' Read the response
The non-streaming response contains id, object, created, model, choices, and usage. Read text from choices[0].message.content; function calls are in choices[0].message.tool_calls. Check finish_reason before treating a generation as complete. Usage includes prompt_tokens, completion_tokens, and total_tokens. Reasoning-capable models may include reasoning_content.
Compatibility
LM0 translates the documented fields into a shared request format. Additional provider-specific fields are not guaranteed to be forwarded. Multiple choices, audio, embeddings, and arbitrary provider extensions are not documented capabilities of this endpoint. Test optional parameters against your chosen model.