Completions
Create a legacy text completion.
POST /completions takes model, prompt as a string, and max_tokens.
It is the legacy text completion API: use it only for a client that needs choices[].text. New code should use Chat completions.
messages is also accepted in place of prompt. Routing fields, streaming and errors work as on chat completions.
On a host with the OpenAI API shape, the gateway sends this request to the host's own legacy completions API, untranslated. On a host with the Anthropic API shape, the gateway translates it through chat completions to /messages.
Azure has the OpenAI API shape but no legacy completions API, so it answers 404 Requested API is currently not supported. Today every served model runs on Azure, so use Chat completions.
Request
curl https://api.plaingateway.com/api/v1/completions \
-H "Authorization: Bearer $PLAINGATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.6-luna",
"prompt": "Say hello in five words.",
"max_tokens": 32
}'Response
Today Azure serves openai/gpt-5.6-luna, so this request gets the host's 404 in the error shape. metadata.raw carries Azure's body, shortened here.
HTTP/1.1 404
{
"error": {
"message": "Provider returned error (request gen-6f2d0c5e9a1b4c7d8e3f2a10)",
"code": 404,
"metadata": {
"provider_name": "Azure",
"raw": "... Requested API is currently not supported ..."
}
}
}