Use EpochLLM with OpenCode

Use one EpochLLM API key to run GPT-6.2 Sol and Claude Fable 5.2 in OpenCode V2.

Get an API key

Install OpenCode V2 if you haven’t already. In your EpochLLM dashboard, open API keys, create a key, and copy it. Inference uses prepaid credits, so check your available balance before running a model. The minimum top-up payment is $5.

Set EPOCH_API_KEY on the OpenCode server that will send requests. For OpenCode’s local shared service, use the command below. For a remote server, set the variable in that server’s environment instead. Keep the real key out of your config and source control.

Set the key for the shared service
opencode service set env EPOCH_API_KEY "YOUR_EPOCH_API_KEY"

To keep the key out of shell history, pass it from a secret manager or an existing environment variable instead of typing it into the command.

Add the provider

Create opencode.jsonc in your project root, or use ~/.config/opencode/opencode.jsonc to make EpochLLM available across projects. If you already have a config, merge the epochllm entry into providers and keep your other settings.

opencode.jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "epochllm": {
      "name": "EpochLLM",
      "env": [
        "EPOCH_API_KEY"
      ],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": {
        "baseURL": "https://epochllm.com/v1"
      },
      "models": {
        "gpt-6.2-sol": {
          "name": "GPT-6.2 Sol"
        },
        "claude-fable-5.2": {
          "name": "Claude Fable 5.2"
        }
      }
    }
  }
}

The epochllm/ prefix is for OpenCode. EpochLLM receives the bare model ID, such as gpt-6.2-sol.

Run a model

Open opencode from your project and enter /models. Choose GPT-6.2 Sol or Claude Fable 5.2 under EpochLLM. To verify the connection from your terminal instead, run either command:

Run GPT-6.2 Sol
opencode run --model epochllm/gpt-6.2-sol "Reply with OK."
Run Claude Fable 5.2
opencode run --model epochllm/claude-fable-5.2 "Reply with OK."

Set a default for new sessions

Add "model": "epochllm/gpt-6.2-sol" at the top level of your config. To default to Claude instead, use epochllm/claude-fable-5.2. Selecting a different model with /models changes only the current session.

Troubleshooting

EpochLLM doesn’t appear in /models
Check that your current project loads the config and that the OpenCode server has EPOCH_API_KEY set. Use opencode auth list to check the environment connection, then open the model picker again.
401 or 402 from EpochLLM
For 401, check that your key is active and belongs to EpochLLM. For 402, check your available credits and any spending limit on the key.
A model isn’t available
Check the exact ID and current availability in the catalog or with GET /v1/models?type=text. A model can appear in the catalog without being available for inference.

EpochLLM API errors · OpenCode custom provider reference