> ## Documentation Index
> Fetch the complete documentation index at: https://docs.layerx1.com/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 lx1_...`. 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.                   |
| `stop`        | string \| string\[] | Stop sequences.                         |
| `stream`      | boolean             | SSE chunks when true.                   |

## Example

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

```json title="Response (shape)" theme={null}
{
  "id": "cmpl_...",
  "object": "text_completion",
  "model": "lx1-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>
