Completions

The legacy prompt-in, text-out endpoint.

POSThttps://your-instance.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.

  • top_pnumberdefault: 1

    Nucleus sampling. Consider setting this or temperature, not both.

  • max_tokensinteger

    Upper bound on generated tokens. The request fails if the prompt plus this exceeds the model's context window.

  • stopstring | string[]

    Up to four sequences that end generation when produced.

curl
curl https://your-instance.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
  }'