Completions

The legacy prompt-in, text-out endpoint.

POSThttps://clawrouter.com/v1/completions

Takes a bare prompt instead of a message list. Kept for older integrations; new code should use chat completions, which every current model is tuned for.

  • modelstringrequired

    Model to use.

  • promptstring | string[]required

    The prompt to complete.

  • streambooleandefault: false

    Stream the completion as it is produced.

  • temperaturenumberdefault: 1

    Sampling temperature between 0 and 2. Lower is more deterministic. Claude Opus 4.7 and later, Claude Sonnet and Haiku 5.x, and Claude Fable accept only the default, so the gateway leaves it out for those models.

  • top_pnumberdefault: 1

    Nucleus sampling. Consider setting this or temperature, not both. Left out for the same Claude models as temperature.

  • max_tokensinteger

    Upper bound on the visible answer. On reasoning models (DeepSeek, Doubao, MiniMax, Kimi, GLM and others) the thinking is generated and billed on top of it, so a max_tokens of 50 can produce thousands of billed tokens; the reasoning share is reported in usage.completion_tokens_details.reasoning_tokens.

  • max_completion_tokensinteger

    Hard cap on everything generated, reasoning included — use this to bound cost. A reasoning model that hits it while still thinking returns an empty answer with finish_reason length.

  • stopstring | string[]

    Up to four sequences that end generation when produced.

curl
curl https://clawrouter.com/v1/completions \
  -H "Authorization: Bearer $CLAWROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-3.5-turbo-instruct",
    "prompt": "Once upon a time",
    "max_tokens": 64
  }'