Skip to main content
OpenCode is an AI coding agent for the terminal. Venice works through OpenCode’s custom provider config using the OpenAI-compatible adapter and a custom base URL.

Custom Provider

Add Venice as a provider in opencode.json

OpenAI Compatible

Uses Venice’s /chat/completions endpoint

Environment Key

Reads your API key from VENICE_API_KEY

Prerequisites


Setup

1

Set your Venice API key

Export your Venice API key in the shell where you run OpenCode:
export VENICE_API_KEY="your-api-key"
2

Create an OpenCode config file

For a project-specific setup, create opencode.json in your project root.For a global setup, use ~/.config/opencode/opencode.json instead.
3

Add the Venice provider

Paste this config into opencode.json:
{
  "$schema": "https://opencode.ai/config.json",
  "model": "venice/zai-org-glm-5-1",
  "small_model": "venice/zai-org-glm-5-1",
  "provider": {
    "venice": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Venice AI",
      "options": {
        "baseURL": "https://api.venice.ai/api/v1",
        "apiKey": "{env:VENICE_API_KEY}"
      },
      "models": {
        "zai-org-glm-5-1": {
          "name": "GLM 5.1"
        },
        "kimi-k2-5": {
          "name": "Kimi K2.5"
        },
        "minimax-m25": {
          "name": "MiniMax M2.5"
        }
      }
    }
  }
}
4

Run OpenCode

Start OpenCode from the same project directory:
opencode
OpenCode will load opencode.json, use VENICE_API_KEY, and route the selected Venice model through https://api.venice.ai/api/v1.

Verify the Setup

Inside OpenCode, run:
/models
You should see the Venice models from your config. Select one, then send a small test prompt. If you set "model": "venice/zai-org-glm-5-1" as shown above, OpenCode should use that Venice model by default. You can change the default by replacing zai-org-glm-5-1 with any model ID from the text model catalog and adding it to the models map.

Config Notes

  • Keep baseURL set to https://api.venice.ai/api/v1. OpenCode’s OpenAI-compatible adapter uses this base URL for chat completions.
  • Keep npm set to @ai-sdk/openai-compatible for Venice’s OpenAI-compatible chat endpoint.
  • The provider ID is venice, so model references use the venice/<model-id> format.
  • If you prefer OpenCode’s /connect flow, choose Other, use venice as the provider ID, paste your Venice API key, and remove options.apiKey from the config.
OpenCode already supports custom provider baseURL values and OpenAI-compatible providers through @ai-sdk/openai-compatible. No OpenCode core provider changes are required for Venice.

Resources

Venice Text Models

Available Venice model IDs

OpenCode Provider Docs

Custom provider and base URL reference