> ## 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.

# Run inference

> Call your deployed models with the OpenAI-compatible Chat Completions API.

Valkyrie serves models through an **OpenAI-compatible** API, so you can use the
official OpenAI SDKs or any tool that speaks that protocol, just point it at your
deployment's base URL and use a Valkyrie API key.

## Endpoint

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

Or, using an [alias](/guides/aliases):

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

## Authentication

Send your API key in the `X-API-Key` header. The OpenAI SDKs send an
`Authorization: Bearer` header, which Valkyrie also accepts, set the SDK's
`api_key` to your Valkyrie key.

## Examples

<CodeGroup>
  ```bash cURL 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 a helpful assistant."},
        {"role": "user", "content": "Explain what Valkyrie does in one sentence."}
      ],
      "temperature": 0.7
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://valkyrie-back.azumo.com/{deployment_slug}/v1",
      api_key="YOUR_VALKYRIE_API_KEY",
  )

  resp = client.chat.completions.create(
      model="{deployment_slug}",
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "Explain what Valkyrie does in one sentence."},
      ],
  )
  print(resp.choices[0].message.content)
  ```

  ```typescript TypeScript theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    baseURL: "https://valkyrie-back.azumo.com/{deployment_slug}/v1",
    apiKey: process.env.VALKYRIE_API_KEY,
  });

  const resp = await client.chat.completions.create({
    model: "{deployment_slug}",
    messages: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: "Explain what Valkyrie does in one sentence." },
    ],
  });
  console.log(resp.choices[0].message.content);
  ```
</CodeGroup>

## Streaming

Set `"stream": true` to receive tokens as server-sent events, exactly as with the
OpenAI API. The SDKs expose this through their streaming helpers.

```python theme={null}
stream = client.chat.completions.create(
    model="{deployment_slug}",
    messages=[{"role": "user", "content": "Write a haiku about GPUs."}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")
```

<Note>
  The `model` field should be your deployment slug (or alias). If a deployment is
  stopped, calls will fail until it is resumed, see
  [Deploy a model](/guides/deploy-model) for stop/resume and schedules.
</Note>

## Errors

Valkyrie returns standard HTTP status codes. See [Errors](/api-reference/errors) for
the common cases and how to handle them.
