Skip to main content
OpenCode is an AI coding agent that runs in your terminal. You can connect it to Routeway by defining a custom provider in ~/.config/opencode/opencode.json and authenticating with your Routeway API key inside OpenCode.
Requires a valid Routeway API key. Get yours from the dashboard.

Setup

1

Install OpenCode

Follow the official installation docs at opencode.ai.
curl -fsSL https://opencode.ai/install | bash
2

Add Routeway as a custom provider

Open ~/.config/opencode/opencode.json and configure a custom provider named routeway:
{
  "$schema": "https://opencode.ai/config.json",
  "disabled_providers": [],
  "provider": {
    "routeway": {
      "name": "Routeway",
      "npm": "@ai-sdk/openai",
      "models": {
        "gpt-4.1": {
          "name": "GPT 4.1",
          "limit": {
            "context": 1048576,
            "output": 32768
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          }
        }
      },
      "options": {
        "baseURL": "https://api.routeway.ai/v1"
      }
    }
  }
}
This example registers gpt-4.1, but you can add any Routeway model. For agentic coding, prefer models with tools support — browse at routeway.ai/models.
3

Connect your API key in OpenCode

Start OpenCode in your project directory:
opencode
Then run:
/connect
In the provider list:
  • Select Routeway
  • Paste your Routeway API key
  • Save the credential
4

Choose the model and start coding

After connecting, select the configured Routeway model in OpenCode and start your session.

Reference

SettingValue
Config file~/.config/opencode/opencode.json
Base URLhttps://api.routeway.ai/v1
Provider namerouteway
Example modelgpt-4.1

Example Prompts

Try these once you’re connected:
  • “Summarize this repository: structure, build system, and entry points.”
  • “Find where feature X is implemented and list the relevant files.”
  • “Run tests and fix the first failing test.”
  • “Refactor module Y and update all call sites.”