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

# Chat Completions

> The OpenAI-compatible chat completions endpoint.

Valkyrie serves deployed models through the OpenAI Chat Completions contract.

## Endpoint

```
POST https://valkyrie-back.azumo.com/{deployment_slug}/v1/chat/completions
```

With an [alias](/guides/aliases):

```
POST https://valkyrie-back.azumo.com/{account_slug}/{alias}/v1/chat/completions
```

## Request

Send the standard OpenAI Chat Completions body. Common fields:

| Field         | Type    | Notes                                          |
| ------------- | ------- | ---------------------------------------------- |
| `model`       | string  | Your deployment slug or alias                  |
| `messages`    | array   | Conversation, each `{ "role", "content" }`     |
| `temperature` | number  | Sampling temperature (optional)                |
| `max_tokens`  | integer | Maximum tokens to generate (optional)          |
| `stream`      | boolean | Stream tokens as server-sent events (optional) |

```bash theme={null}
curl https://valkyrie-back.azumo.com/{deployment_slug}/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $VALKYRIE_API_KEY" \
  -d '{
    "model": "{deployment_slug}",
    "messages": [
      {"role": "system", "content": "You are concise."},
      {"role": "user", "content": "What is Valkyrie?"}
    ],
    "temperature": 0.7,
    "max_tokens": 256
  }'
```

## Response

The response follows the OpenAI shape:

```json theme={null}
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "model": "{deployment_slug}",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "..." },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0
  }
}
```

## Streaming

Set `"stream": true` to receive incremental `chat.completion.chunk` events as
server-sent events, terminated by a `[DONE]` sentinel, identical to the OpenAI
streaming format. The OpenAI SDKs expose this through their streaming helpers.

<Note>
  Supported sampling parameters and context length depend on the deployed model and
  its serving engine. If a deployment is stopped, requests fail until it is resumed.
</Note>
