Skip to content

Completions (legacy)

POST /v1/completions takes OpenAI’s older text completion request. It supports every chat model by sending your prompt as a single user message. Use Chat Completions for anything new.

Terminal window
curl https://api.indorouter.ai/v1/completions \
-H "Authorization: Bearer $INDOROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "openai/gpt-4o-mini", "prompt": "hello", "max_tokens": 50}'

Only these fields are kept: model, prompt, suffix, max_tokens, temperature, top_p, stop, stream, stream_options, n, seed, presence_penalty, frequency_penalty and user. Every other field, including max_completion_tokens, response_format, tools and reasoning_effort, is dropped without an error.

These are refused with 400 invalid_completion_request:

  • no prompt, or a prompt that is not a string (a list holding one string is accepted),
  • more than one prompt in one request,
  • a prompt given as token IDs,
  • echo: true, best_of above 1, or logprobs.

suffix (fill-in-the-middle) works only on models whose vendor serves it, such as DeepSeek’s. Other models refuse it with 400 fill_in_middle_not_served.

The response has "object": "text_completion" and choices[].text, with the same usage, headers, streaming ending and errors as Chat Completions.