Skip to main content
This documentation is provided for informational purposes only and demonstrates how to configure and use our API with third-party AI chat interfaces. Any third-party software, websites, or services mentioned are not operated, controlled, or endorsed by us.

Introduction to OpenCode

Image
OpenCode is an open source AI coding agent. It’s available as a terminal-based interface, desktop app, or IDE extension.OpenCode Key Features:
  • Local-first, privacy-focused
  • Supports 75+ AI models
  • Terminal-based interactive UI
  • Code generation, debugging & refactoring
  • Plugin & tool integrations (MCP)
  • Agent modes for coding & planning
  • Multi-session support
  • LSP-powered code intelligence
  • Highly customizable & extensible
  • Automation with shell & file operations

Step

1

Install OpenCode

Install the newest LTS version of Node.jsAfter installation is complete, open the terminal (Windows users use PowerShell) and check the version number.
  • macOS, Linux, Windows:
npm install -g opencode-ai
2

OpenCode CLI credential registration

Before modifying the configuration file, you need to register a provider alias (Provider ID) in the local key manager. This step ensures the secure hosting of the API Key, preventing it from being hardcoded in plain text within the configuration file.Execute the authentication command:
opencode auth login
Select the type: Locate and select “other” at the bottom of the list (you can directly type to search).
Define the ID: Enter “local”.
Enter the key: Input the token key API Key (sk-xxxx) that you have created from RouterLink Key.
3

Configure OpenCode

OpenCode uses the opencode.json file to parse provider parameters. Please locate and create/edit this file according to your operating system.Edit or create opencode.json fileOn macOS & Linux: ~/.config/opencode/opencode.jsonOn Windows: C:\Users\<USERNAME>\.config\opencode\opencode.jsonConfiguration file:
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "local": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "local",
      "options": {
        "baseURL": "https://router-link.world3.ai/api/v1"
      },
      "models": {
        "world3-router-north-america/openai/gpt-5.3-codex": {
          "name": "gpt-5.3-codex"
        },
        "world3-router-north-america/google/gemini-3.1-pro-preview": {
          "name": "gemini-3.1-pro-preview"
        },
        "world3-router-north-america/anthropic/claude-opus-4.7": {
          "name": "claude-opus-4.7"
        }
      }
    }
  }
}
npm: Use @ai-sdk/openai-compatible to adapt to the OpenAI-compatible protocol.baseURL: Enter the API endpoint of the RouterLink platform.models: You need to manually declare the list of models supported by the RouterLink platform. The keys must correspond to the actual Model IDs.
4

OpenCode Loading and Validation

Launch the main program:
opencode
Enter the following command in the interactive prompt to open the model menu: /models
Ocode1 1
If the configuration is correct, you will see the custom n1n platform and its models listed.
Ocode2