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 | bashOr via npm:
npm install -g opencode-aiStep 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 loginSelect 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:
opencodeUse the /models command inside the TUI to confirm your models are available.
Recommended Models for OpenCode
| Use Case | Model | Why |
|---|---|---|
| Complex reasoning & planning | openai/gpt-5.4 | Highest capability |
| Code generation & refactoring | openai/gpt-5.3-codex | Optimized for code |
| Large codebase analysis | openai/gemini-3.1-pro | 1M+ token context |
| Quick operations | openai/glm-5-turbo | Fast, low latency |
| Budget workloads | openai/glm-5 | Cost-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
baseURLis exactlyhttps://api.revomail.io/v1(no trailing slash) - Run
opencode auth listto confirm your API key is stored - Try
opencode models --refreshto update the cached model list
Authentication errors
- Ensure your Revo Mail API key is set via
opencode auth loginor theOPENAI_API_KEYenvironment variable - Check that your key is valid at revomail.io/keys
Model not found errors
- Use model names in the
provider/modelformat (e.g.,openai/gpt-5.4) - Run
opencode models openaito 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/modelformat — prefix Revo Mail models withopenai/ - The
small_modelsetting 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.jsonin project root) - All token consumption appears in your Revo Mail dashboard in real-time