Connect OpenCode#
Connect OpenCode to OptScale AI so agent chats use models from your organization catalog instead of a standalone vendor account.
In Chat, copy Base URL, API key, and Model name from Get connection values from Chat before you configure OpenCode.
For shared model naming rules and limitations, see External Tools overview.
Prerequisites#
Ensure the following prerequisites are met before configuring OpenCode:
- An organization and at least one Active provider exist.
- Allowed providers are assigned for the user (who is connecting OpenCode to OptScale AI).
- The OptScale AI deployment exposes a valid TLS certificate (HTTPS is required).
- For agent workflows with tools, use models that support tool execution (for example,
llama3:latestmay not support tools).
Configure OpenCode#
1. In OpenCode, open File → Settings.
2. Go to Providers → Custom provider.
3. Fill in the required fields using the values from Get connection values from Chat:
| Field | Value from Chat | Example |
|---|---|---|
| Base URL | Copy the Base URL value | https://localhost:3001/llm_proxy/8f3c2a1b-4d5e-6789-abcd-ef0123456789/v1 |
| API key | Copy the API key value | 5e0f3a67-84c2-4d0f-ad9d-ec2dc4cecb69 |
| Models | Copy the Model name value | gpt-oss:120b |
4. Save the provider configuration.
Models registered in OptScale AI are now available in OpenCode chat.
Verify the OpenCode connection#
- Open an OpenCode chat and select a configured model.
- Send a test prompt and confirm that the model returns a response.
- In the Admin UI, open Traces or Usage and Cost and confirm the request appears under your organization and user.
OpenCode setup notes#
- The Base URL from Chat must use HTTPS with a trusted certificate on your cluster (HTTP may appear only in local deployments).
- For OpenCode agent workflows that call tools, choose a model that supports tool execution in Chat before copying Model name (see Model identifiers when the same name exists on multiple providers).
Related documentation#
| Topic | Where to read more |
|---|---|
| Connection values from Chat | Get connection values from Chat |
| External tools overview | External Tools |
| Connect Cursor | Connect Cursor |
| Initial setup | First Steps |
| AI Access and allowed providers | Core Services — AI Access |
| Request monitoring | Core Services — Traces |
| Chat UI | Interface Overview |