Seedance 2.0 15% OFF | Create in Video Generator →
Agent setup

Connect OpenCode to WaveSpeed LLM API

Copy the recommended ~/.config/opencode/opencode.json setup for OpenCode, route requests to /v1/chat/completions, and verify local agent calls in WaveSpeed Logs.

Config file

~/.config/opencode/opencode.json

Protocol

OpenAI-compatible chat completions

Endpoint

/v1/chat/completions

Quick start

1

Create a WaveSpeed access key

2

Export the required key locally

3

Paste config into~/.config/opencode/opencode.json

4

Run opencode and check Logs

OpenAI-compatible chat completions

Usage appears in Dashboard and Logs

Switch models without rewriting agent code

Edit ~/.config/opencode/opencode.json
// File: ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "wavespeed": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "WaveSpeed AI",
      "options": {
        "baseURL": "https://llm.wavespeed.ai/v1",
        "apiKey": "{env:WAVESPEED_API_KEY}"
      },
      "models": {
        "anthropic/claude-opus-4.8": {
          "name": "anthropic/claude-opus-4.8",
          "tool_call": true
        }
      }
    }
  },
  "model": "wavespeed/anthropic/claude-opus-4.8"
}

Agent integration guide

Use OpenCode with WaveSpeed LLM API

This guide shows how to connect OpenCode to WaveSpeed AI with ~/.config/opencode/opencode.json, OpenAI-compatible chat completions, /v1/chat/completions, base URL https://llm.wavespeed.ai/v1, and default model anthropic/claude-opus-4.8. Copy the configuration above, export your API key, run the agent, then verify requests in Logs.

1

Create a WaveSpeed access key

2

Export the required key locally

3

Paste config into

~/.config/opencode/opencode.json
4

Run opencode and check Logs

What this OpenCode setup configures

Protocol

OpenAI-compatible chat completions

Endpoint

/v1/chat/completions

Model

anthropic/claude-opus-4.8

The copy-ready configuration above is the only OpenCode file you need to edit for the recommended setup: ~/.config/opencode/opencode.json. Keep the API key in your shell environment so it is not committed to a repository.

Troubleshooting

The API key is not being picked up

Export WAVESPEED_API_KEY in the same shell where you run OpenCode. If you use a shell profile, reload the terminal before starting the agent.

Requests fail with a protocol or endpoint error

Check that OpenCode is using OpenAI-compatible chat completions and endpoint /v1/chat/completions. Protocol mismatches are the most common cause of 404 or payload errors.

The selected model does not work

Confirm the model id exists in WaveSpeed Models, then paste the exact id into ~/.config/opencode/opencode.json. You can start with the default model shown on this page.

No requests appear in Logs

Make sure OpenCode is using the WaveSpeed base URL and your current API key. Then send a new prompt from the local agent and refresh Logs.

Can this OpenCode guide show up in search?

Yes. This page is built as an indexable setup guide for users searching for OpenCode custom provider, OpenAI-compatible endpoint, base URL, and local agent configuration workflows.