Overview
This guide explains how to connect OpenCode to the Agnes-2.0-Flash model. After configuration, you can use Agnes models in OpenCode for code generation, project analysis, code editing, and multi-turn development conversations.This guide is based on OpenCode
1.15.13.Prerequisites
Before you start, make sure you have completed the following steps:- Registered an Agnes AI account
- Logged in to the Agnes API Platform
- Created and copied your API Key
- Confirmed that your network can access the Agnes API Gateway
OpenCode CLI Configuration
Use Case
This method is for users who use OpenCode through the terminal. If you already have an OpenCode configuration file, you only need to add theagnes provider and set the default model to:
Configuration Example
Open your OpenCode configuration file and add the following configuration:If your configuration file already contains other providers, do not overwrite
the entire file. Add
agnes under provider, then set model to
agnes/agnes-2.0-flash.Configure the Environment Variable
Set your Agnes API Key in the terminal:Verify CLI Configuration
Start OpenCode and run:OpenCode Desktop Configuration
Use Case
This method is for users who use the OpenCode Desktop graphical interface.Configuration Steps
1
Open Settings
Launch OpenCode Desktop and click the settings button in the lower-left corner.
2
Go to Providers
In the settings page, click Providers from the left-side menu.
3
Choose Custom Provider
Find Custom Provider in the provider list and click Connect.
4
Fill in Provider Information
Enter the Agnes provider information according to the table below.
Provider Configuration
Example:
Verify Desktop Configuration
Return to the OpenCode Desktop main interface. In the model selector, choose:Common Issues
Agnes model does not appear
Check the following items:- The Provider ID is
agnes - The Base URL is
https://apihub.agnes-ai.com/v1 - The Model ID is
agnes-2.0-flash - The API Key is correct
- The API Key does not include
Bearer
API Key error
Make sure the API Key is copied from Agnes Platform and does not contain extra spaces. Correct example:Request failed or cannot connect
Check the following items:- Your network can access the Agnes API Gateway
- The Base URL only ends with
/v1 - The Base URL is not written as
/v1/chat/completions - Your API Key is still valid