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

- 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
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:
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: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.
Define the ID: Enter “local”.Enter the key: Input the token key API Key (sk-xxxx) that you have created from RouterLink Key.
Configure OpenCode
OpenCode uses the npm: Use
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:@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.


