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 exists and at least one Active provider is configured.
- Allowed providers are assigned to the user connecting OpenCode to OptScale AI.
- The OptScale AI deployment is accessible over HTTPS with a valid TLS certificate.
- For agent workflows that use tools, select models that support tool execution. For example,
llama3:latestmay not support tools.
Configure OpenCode#
-
In OpenCode, open File → Settings.
-
Go to Providers → Custom Provider and click Connect.
-
Enter the Provider ID and Display Name. The Provider ID can contain only lowercase letters, numbers, hyphens (
-), and underscores (_). For example, useoptscale-aias the Provider ID andOptScale AIas the Display Name. -
Enter the Base URL value: OptScale AI Chat → Connect this model to external tools → OPENAI-COMPATIBLE → copy the Base URL value.
-
Enter the API Key value: OptScale AI Chat → Connect this model to external tools → OPENAI-COMPATIBLE → copy the API key value.
-
Configure the model list in the Models section:
-
Model-Name: Enter a descriptive label for the model. For example,
OpenCode via OptScale AI. -
value: OptScale AI Chat → Connect this model to external tools → OPENAI-COMPATIBLE → copy the Model name value.
-
-
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.
Related documentation#
After connecting OpenCode, you may want to:
- Review shared connection values in Get connection values from Chat.
- Read the broader External Tools overview.
- Configure another client with Connect Cursor or Connect Claude.
- Check setup requirements in First Steps.
- Manage user access in Core Services — AI Access.
- Monitor requests in Core Services — Traces.
- Review Chat controls in Interface Overview.