Completions
Legacy text completions endpoint. POST /api/v1/completions.
Navigation
Completions (Legacy)
POST /api/v1/completionsCreates a completion for the given prompt. This is the legacy text completions endpoint — for new projects, use Chat Completions instead.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID |
prompt | string | Yes | The text prompt to complete |
max_tokens | integer | No | Maximum tokens to generate |
stream | boolean | No | Whether to stream the response |
temperature | number | No | Sampling temperature (0-2) |
Response
{
"id": "cmpl-abc123",
"object": "text_completion",
"created": 1714000000,
"model": "llama-4-scout",
"choices": [
{
"text": "\n\nThe answer is 42.",
"index": 0,
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 5,
"completion_tokens": 10,
"total_tokens": 15
}
}