$Arvika Labs Docs

OpenCode

Configure OpenCode, the open-source AI coding assistant, to route through Arvika Labs for unified model access and billing.

Model slugs in examples are illustrative. Confirm current availability in the live catalog and your account's /v1/models before use.

What This Does

OpenCode is an open-source AI coding assistant for the terminal. It supports 75+ LLM providers and local models out of the box. By configuring it to use Arvika Labs's OpenAI-compatible endpoint, you can access any supported model through a single account while keeping all your AI spending consolidated.


Setup

Step 1: Install OpenCode

curl -fsSL https://opencode.ai/install.sh | bash

Or via npm:

npm install -g opencode-ai

Step 2: Configure the Provider

OpenCode uses a JSON config file. Create or edit opencode.json in your project root (or globally at ~/.config/opencode/opencode.json):

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "openai": {
      "options": {
        "baseURL": "https://api.labs.arvikaconsulting.com/v1"
      }
    }
  },
  "model": "openai/kimi-k2.6",
  "small_model": "openai/glm-5.3-flash"
}

Replace the API key placeholder with your actual key from labs.arvikaconsulting.com/keys.

Step 3: Set Your API Key

Run the built-in auth command to store your Arvika Labs API key:

opencode auth login

Select OpenAI as the provider and paste your Arvika Labs API key when prompted. Credentials are stored in ~/.local/share/opencode/auth.json.

Alternatively, set the environment variable:

export OPENAI_API_KEY="YOUR_Arvika Labs_API_KEY"

Step 4: Verify the Connection

Launch OpenCode and select your model:

opencode

Use the /models command inside the TUI to confirm your models are available.


Use CaseModelWhy
Complex reasoning & planningopenai/kimi-k2.6Highest capability
Code generation & refactoringopenai/deepseek-v4-proOptimized for code
Large codebase analysisopenai/minimax-m31M+ token context
Quick operationsopenai/glm-5.3-flashFast, 1M-token context
Budget workloadsopenai/glm-5.3-flash$0.075 input / $0.25 output per 1M tokens

Non-Interactive Usage

Run a single prompt without launching the TUI:

opencode run "Explain how closures work in JavaScript"

Specify a model directly:

opencode run -m openai/deepseek-v4-pro "Refactor this function"

Troubleshooting

Provider not showing models

  • Verify the baseURL is exactly https://api.labs.arvikaconsulting.com/v1 (no trailing slash)
  • Run opencode auth list to confirm your API key is stored
  • Try opencode models --refresh to update the cached model list

Authentication errors

  • Ensure your Arvika Labs API key is set via opencode auth login or the OPENAI_API_KEY environment variable
  • Check that your key is valid at labs.arvikaconsulting.com/keys

Model not found errors

  • Use model names in the provider/model format (e.g., openai/kimi-k2.6)
  • Run opencode models openai to list available models from the OpenAI provider

Connection timeout

  • Verify your network can reach api.labs.arvikaconsulting.com
  • Try increasing the timeout in your provider config:
{
  "provider": {
    "openai": {
      "options": {
        "baseURL": "https://api.labs.arvikaconsulting.com/v1",
        "timeout": 600000
      }
    }
  }
}

Notes

  • OpenCode model names use the provider/model format — prefix Arvika Labs models with openai/
  • The small_model setting is used for lightweight tasks like title generation — set it to a low-cost model
  • Config can be placed globally (~/.config/opencode/opencode.json) or per-project (opencode.json in project root)
  • All token consumption appears in your Arvika Labs dashboard in real-time

On this page