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

# Opencode

> Use a Valkyrie model in Opencode as a custom OpenAI-compatible provider.

[Opencode](https://opencode.ai) lets you add a custom provider through its AI SDK
support, so you can point it at a Valkyrie deployment over the OpenAI-compatible API.

## Configure the provider

Add Valkyrie to your Opencode config, either global at
`~/.config/opencode/opencode.json` or per-project at `./opencode.json`:

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "valkyrie": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Valkyrie",
      "options": {
        "baseURL": "https://valkyrie-back.azumo.com/{deployment_slug}/v1",
        "apiKey": "{env:VALKYRIE_API_KEY}"
      },
      "models": {
        "your-model-id": { "name": "Valkyrie model" }
      }
    }
  },
  "model": "valkyrie/your-model-id"
}
```

Then export your key and start Opencode:

```bash theme={null}
export VALKYRIE_API_KEY="vk_dep_your_deployment_key"
opencode
```

<Note>
  The `baseURL` ends in `/v1`. Use your deployment slug (`deployment-{id}`) or an
  [alias](/guides/aliases) in place of `{deployment_slug}`, and set `your-model-id`
  to the model your deployment serves. `{env:VAR}` reads the key from the environment
  so it never lands in the config file.
</Note>

## A real example

Against Valkyrie's shared Qwen deployment (alias `qwen`, model
`RadixArk/Qwen3.8-27B-NVFP4`):

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "valkyrie": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Valkyrie",
      "options": {
        "baseURL": "https://valkyrie-back.azumo.com/qwen/v1",
        "apiKey": "{env:VALKYRIE_API_KEY}"
      },
      "models": {
        "RadixArk/Qwen3.8-27B-NVFP4": { "name": "Valkyrie Qwen 27B" }
      }
    }
  },
  "model": "valkyrie/RadixArk/Qwen3.8-27B-NVFP4"
}
```
