Skip to content
API reference

Chat Completions

Generate text with the OpenAI-compatible chat interface.

POST/v1/chat/completionsapi.17.wtf
On this page Request bodyMessages & contentExample requestRead the responseCompatibility

Request body

ParameterType / requirementDescription
modelstring · requiredExact text model ID from the catalog.
messagesarray · requiredConversation messages with role and content.
max_tokensinteger · optionalPositive output limit; defaults to 4096.
max_completion_tokensinteger · optionalAlternative output limit; takes precedence over max_tokens.
temperaturenumber · optionalSampling control; accepted range depends on model.
top_pnumber · optionalNucleus sampling; model dependent.
stopstring or string[] · optionalStop sequences.
streamboolean · optionalDefaults to false. Use true for SSE.
toolsarray · optionalFunction definitions with name, description, parameters.
tool_choicestring or object · optionalauto, required, none, or a named function.
reasoning_effortstring · optionalModel-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.