> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sideren.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Completions (legacy).

> The legacy OpenAI text-completions dialect — prompt in, text out. Supported so older tools keep working unmodified; new integrations should use Chat Completions.

## Endpoint

```http theme={null}
POST /v1/completions
```

Authenticate with `Authorization: Bearer sdn_...`. Any model in the [catalog](/models) is
valid in `model`.

## Request parameters

| Parameter | Type | Notes |
| - | - | - |
| `model` | string · required | Any catalog id. |
| `prompt` | string · required | Raw text prompt — no message structure. |
| `max_tokens` | integer | Output ceiling. |
| `temperature` | number | Sampling temperature. |
| `top_p` | number | Nucleus sampling. |
| `stop` | string \| string\[] | Stop sequences. |
| `stream` | boolean | SSE chunks when true. |
| `seed` · `frequency_penalty` · `presence_penalty` | | Standard sampling knobs, forwarded for models that take them. |
| `prompt_cache_key` | string | A conversation-stable identity hint used for cache affinity — `user` is accepted as a fallback. See [Prompt caching](/guides/prompt-caching). |

A few legacy OpenAI parameters are refused with a `400` rather than silently ignored:
`n > 1` (multiple choices), `echo: true`, a non-empty `suffix` (fill-in-the-middle), and
multi-element `prompt` arrays.

## Example

```sh title="Request" theme={null}
curl https://api.sideren.io/v1/completions \
  -H "authorization: Bearer $SIDEREN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "@sdn/gpt-oss-120b",
    "prompt": "The capital of France is",
    "max_tokens": 16
  }'
```

```json title="Response (shape)" theme={null}
{
  "id": "cmpl_...",
  "object": "text_completion",
  "model": "@sdn/gpt-oss-120b",
  "choices": [{
    "index": 0,
    "text": " Paris.",
    "finish_reason": "stop"
  }],
  "usage": { "prompt_tokens": 6, "completion_tokens": 3, "total_tokens": 9 }
}
```

## When to use it

Only when a tool you don't control requires it. Chat-tuned models expect message
structure — the same request through [Chat Completions](/api/chat-completions) will
generally behave better, and tools, vision, and structured output live on the chat
surfaces only.

<Note>
  Errors follow the OpenAI shape, like Chat Completions — see [Errors](/errors).
</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.