$Revo Mail Docs

OpenCode

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

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 Revo Mail'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.revomail.io/v1"
      }
    }
  },
  "model": "openai/gpt-5.4",
  "small_model": "openai/glm-5-turbo"
}

Replace the API key placeholder with your actual key from revomail.io/keys.

Step 3: Set Your API Key

Run the built-in auth command to store your Revo Mail API key:

opencode auth login

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

Alternatively, set the environment variable:

export OPENAI_API_KEY="YOUR_Revo Mail_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/gpt-5.4Highest capability
Code generation & refactoringopenai/gpt-5.3-codexOptimized for code
Large codebase analysisopenai/gemini-3.1-pro1M+ token context
Quick operationsopenai/glm-5-turboFast, low latency
Budget workloadsopenai/glm-5Cost-effective

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/gpt-5.3-codex "Refactor this function"

Troubleshooting

Provider not showing models

  • Verify the baseURL is exactly https://api.revomail.io/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 Revo Mail API key is set via opencode auth login or the OPENAI_API_KEY environment variable
  • Check that your key is valid at revomail.io/keys

Model not found errors

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

Connection timeout

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

Notes

  • OpenCode model names use the provider/model format — prefix Revo Mail 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 Revo Mail dashboard in real-time

On this page