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

# POST /completions

> Use ThinkFeel through an OpenAI-compatible text completions endpoint.

ThinkFeel supports an OpenAI-compatible text completions endpoint at `/api/v1/completions`. OpenAI SDKs for Completions, including AI SDK, can point their base URL to `https://playground.curvelabs.org/api/v1`.

```text theme={null}
POST https://playground.curvelabs.org/api/v1/completions
```

<Info>
  This is different from the ThinkFeel SDK and CLI base URL setting, which should use only the site origin. Send either
  `prompt` or `messages`, not both. `model` must be your persona ID.
</Info>

## Headers

| Header          | Type   | Required    | Description                                                                    |
| --------------- | ------ | ----------- | ------------------------------------------------------------------------------ |
| `Content-Type`  | string | Yes         | Must be `application/json`                                                     |
| `Authorization` | string | Conditional | OpenAI-style bearer API key for API-key billing                                |
| `x-api-key`     | string | Conditional | Alternative to `Authorization`; one key header is required for API-key billing |

## Body parameters

| Parameter  | Type                   | Required    | Description                                                                                                                   |
| ---------- | ---------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `model`    | string                 | Yes         | Persona ID UUID only                                                                                                          |
| `messages` | array                  | Conditional | Multi-turn text messages; accepts `user`, `assistant`, `system`, and `developer` roles with string or text-part array content |
| `prompt`   | string or string array | Conditional | Text prompt, as a string or one-item array, when `messages` is omitted                                                        |
| `n`        | number                 | No          | Number of completions, 1-5. Defaults to 1                                                                                     |
| `echo`     | boolean                | No          | Prepend the prompt to the output text                                                                                         |
| `stop`     | string or string array | No          | Stop sequence or sequences                                                                                                    |

## Compatibility notes

* Provide either `prompt` or `messages`.
* When using `messages`, include the full conversation history and ensure the last role is `user`.
* `messages` supports `user`, `assistant`, `system`, and `developer` roles.
* `model` must be your persona ID UUID provided during onboarding.
* `prompt` must be a string or a single-element array.
* `n` is capped at 5.
* Message content can be a plain string or an array of text parts.
* Optional `timestamp`, `createdAt`, and `created_at` values are accepted and normalized when present.
* Streaming is not supported on this V1 endpoint. `stream: true` returns an error.
* `max_tokens` and `logprobs` are rejected.
* Other OpenAI parameters are accepted but ignored: `temperature`, `top_p`, `presence_penalty`, `frequency_penalty`, `best_of`, `seed`, `suffix`, and `user`.
* Output text is normalized, stop sequences are applied, and `echo` prepends the prompt.
* Responses omit `usage`.

## Request

```bash theme={null}
curl -X POST https://playground.curvelabs.org/api/v1/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY_HERE" \
  -d '{
    "model": "YOUR_PERSONA_ID",
    "prompt": "hey, how's your day?",
    "n": 1,
    "echo": false,
    "stop": ["\n\n"]
  }'
```

## Response

```json theme={null}
{
  "id": "cmpl-...",
  "object": "text_completion",
  "created": 1737656583,
  "model": "YOUR_PERSONA_ID",
  "choices": [
    {
      "text": "pretty chill so far, you?",
      "index": 0,
      "logprobs": null,
      "finish_reason": "stop",
      "chunks": ["pretty chill so far, you?"]
    }
  ]
}
```
