Skip to content

OpenCode

OpenCode can call CompactifAI through the same OpenAI-compatible chat completions API you use elsewhere: register a custom provider with our base URL and API key, then map each model id and display name for the models your account can use.

You need a CompactifAI API key and the correct model id for each model (for example hypernova-60b or glm-5-1). Use CompactifAI API https://api.compactif.ai/v1 unless you are explicitly targeting another environment.

Click the model button in the bottom toolbar (it shows the currently selected model, such as a default OpenCode Zen model).

OpenCode: click the model button

In the model menu, open Manage models (settings / sliders icon next to the search field).

OpenCode: Manage models

In the Manage models window, click + Connect provider.

OpenCode: Connect provider

In Connect provider, open the Custom entry (under Other) to add an OpenAI-compatible endpoint.

OpenCode: Custom provider

In the Custom provider form, fill in:

FieldValue
Provider IDcai (lowercase letters, numbers, hyphens, or underscores)
Display nameCompactifAI
Base URLhttps://api.compactif.ai/v1
API keyYour CompactifAI API key

Under Models, add each model your workspace should expose—for example:

  • ID: hypernova-60b (or another catalog ID such as glm-5-1)
  • Name: Hypernova 60B

Use + Add model for additional CompactifAI models; ID must match the API model identifier from the models catalog.

OpenCode: Custom provider form

Click Submit to save the provider.

OpenCode: Submit custom provider

Fully quit OpenCode and start it again. Then open the model control so you can pick from providers as before.

OpenCode: restart and open model picker

Scroll in the model list until you see the CompactifAI section with the models you configured.

OpenCode: CompactifAI provider and models

Choose a CompactifAI model from the list and start your session. Requests use the same /v1/chat/completions flow described in Chat Completion.

OpenCode: working with a CompactifAI model

Happy coding.

For request and response fields, see Chat Completion and the API reference.