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

## The quick way: from the endpoint page

**1. Open the endpoint**

In the dashboard, open **Endpoints** and click the endpoint you want to use.
It can be running, paused, or off on its schedule.

**2. Create a key for it**

Click **Create a key for this endpoint** and give the key a name, for example
`opencode laptop`.

**3. Paste the config**

The key is shown once, with an **OpenCode** tab holding a ready-to-paste
provider block: the endpoint's base URL, the key and the model name. Merge it
into your Opencode config, global at `~/.config/opencode/opencode.json` or
per-project at `./opencode.json`, then pick the model in Opencode.

You can create a key for any endpoint you may use, including one shared with you
or owned by your organization. See
[Create a key for an endpoint](https://docs.valkyrieapp.azumo.com/dashboard/endpoints.md#create-a-key-for-an-endpoint).

> [!NOTE]
>
> The URL works only while the endpoint is running. An endpoint that is **Off
> (schedule)** starts again by itself at the time its badge shows, for example
> **Off (schedule) · starts Tue 09:00**; until then Opencode's requests fail. A
> paused or idle-stopped endpoint needs someone to resume or start it. The
> endpoint's page and the Endpoints list show its status and schedule, see
> [Deployment status](https://docs.valkyrieapp.azumo.com/guides/deployment-status.md#statuses).

## Configure the provider by hand

The pasted block looks like this. To write it yourself, use the endpoint's URL
from its page (shown while it runs) and a key from
[API keys](https://docs.valkyrieapp.azumo.com/dashboard/api-keys.md):

```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 or an
> [alias](https://docs.valkyrieapp.azumo.com/guides/aliases.md) in place of `{deployment_slug}`, and set `your-model-id`
> to the model your deployment serves (the endpoint page shows it next to
> **Create a key for this endpoint**). `{env:VAR}` reads the key from the
> environment so it never lands in the config file.

## 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"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.