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

# OpenAI-compatible clients

> The generic recipe for connecting any OpenAI-compatible SDK or app to Valkyrie.

Valkyrie serves models through the OpenAI Chat Completions API, so any client that
lets you set a **base URL** and **API key** can talk to a Valkyrie deployment.

## The three values you need

| Setting  | Value                                                  |
| -------- | ------------------------------------------------------ |
| Base URL | `https://valkyrie-back.azumo.com/{deployment_slug}/v1` |
| API key  | Your deployment key (`vk_dep_`)                        |
| Model    | Your deployment slug (or [alias](/guides/aliases))     |

The **deployment slug** looks like `deployment-{id}` (for example `deployment-213`).
With an alias, the base URL becomes
`https://valkyrie-back.azumo.com/{account_slug}/{alias}/v1`.

## Official OpenAI SDKs

<CodeGroup>
  ```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": "user", "content": "Hello!"}],
  )
  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: "user", content: "Hello!" }],
  });
  console.log(resp.choices[0].message.content);
  ```
</CodeGroup>

## LangChain

```python theme={null}
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://valkyrie-back.azumo.com/{deployment_slug}/v1",
    api_key="YOUR_VALKYRIE_API_KEY",
    model="{deployment_slug}",
)
print(llm.invoke("Hello!").content)
```

## Anything else

Any app with an "OpenAI-compatible" or "custom OpenAI endpoint" setting works the
same way, LibreChat, Open WebUI, editor plugins, and more. Set the base URL, key,
and model name as above.

<Tip>
  Set `stream: true` for token streaming. See [Run inference](/guides/inference) for
  a streaming example and [Errors](/api-reference/errors) for handling failures.
</Tip>
