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

# Legacy Text Completions – Prompt-In, Completion-Out API

> Use the legacy text completions endpoint for prompt-in, completion-out workflows — parameters, an example request, and when to prefer chat completions.

The `/v1/completions` endpoint accepts a text prompt and returns a completion. It is a legacy endpoint — for new projects, use `/v1/chat/completions` instead. It is included for compatibility with tools that depend on the completions interface, such as older SDKs or fine-tuned workflows built around raw prompt templates.

<Info>
  For new integrations, use `/v1/chat/completions` — it supports system prompts, tool calls, and structured output.
</Info>

## Endpoint

```
POST https://api.boole.dev/v1/completions
```

## Request Body

<ParamField body="model" type="string" required>
  Model slug to use for the request, e.g. `llama-3.3-70b-instruct`. See [Models](/api-reference/models) for all available slugs.
</ParamField>

<ParamField body="prompt" type="string" required>
  The text prompt to complete. The model continues generation from wherever the prompt ends.
</ParamField>

<ParamField body="max_tokens" type="integer">
  Maximum number of tokens to generate. Default: `16`.
</ParamField>

<ParamField body="temperature" type="number">
  Sampling temperature between `0` and `2`. Lower values produce more deterministic output. Default: `1`.
</ParamField>

<ParamField body="stream" type="boolean">
  When `true`, streams the response as server-sent events. Default: `false`.
</ParamField>

<ParamField body="stop" type="string | array">
  One or more sequences at which generation stops. Generation halts as soon as any sequence in the list is encountered.
</ParamField>

<ParamField body="top_p" type="number">
  Nucleus sampling probability mass. Only tokens comprising the top `top_p` probability are considered. Default: `1`.
</ParamField>

## Example Request

```bash theme={null}
curl https://api.boole.dev/v1/completions \
  -H "Authorization: Bearer $BOOLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama-3.3-70b-instruct",
    "prompt": "The capital of France is",
    "max_tokens": 10
  }'
```

## Example Response

```json theme={null}
{
  "id": "cmpl-abc123",
  "object": "text_completion",
  "created": 1720000000,
  "model": "llama-3.3-70b-instruct",
  "choices": [
    {
      "text": " Paris.",
      "index": 0,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 7,
    "completion_tokens": 2,
    "total_tokens": 9
  }
}
```

## Response Fields

<ResponseField name="id" type="string">
  Unique identifier for the completion. Use this for logging and tracing.
</ResponseField>

<ResponseField name="choices[].text" type="string">
  The generated text continuation from the model for this choice.
</ResponseField>

<ResponseField name="choices[].finish_reason" type="string">
  Reason generation stopped. Common values: `"stop"` (natural end or stop sequence hit), `"length"` (max\_tokens reached).
</ResponseField>

<ResponseField name="usage.prompt_tokens" type="integer">
  Number of tokens in the input prompt.
</ResponseField>

<ResponseField name="usage.completion_tokens" type="integer">
  Number of tokens generated in the response.
</ResponseField>
