Tools

opencode

Set up opencode with Cognitivers, then verify your connection.

Connects directly

Terminal agent configured with a JSON file and the AI SDK.

Checked Official documentation (opens in a new tab)

1. Before you begin

Configuration location

opencode.json in the project, or ~/.config/opencode/opencode.json

Need an API key? Request access before running these examples.

2. Configure the connection

Apply the following configuration in the location above. Replace credential placeholders with your own key; keep secrets out of version control.

opencode · jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "cognitivers": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Cognitivers",
      "options": {
        "baseURL": "https://api.cognitivers.com/v1",
        "apiKey": "{env:COGNITIVERS_API_KEY}"
      },
      "models": {
        "cog-fast": { "name": "Cog Fast" },
        "cog-pro": { "name": "Cog Pro" }
      }
    }
  },
  "model": "cognitivers/cog-pro",
  "small_model": "cognitivers/cog-fast"
}

Compatibility notes

  • Use the npm package @ai-sdk/openai-compatible for chat completions. @ai-sdk/openai targets the Responses API instead.
  • Model ids under models must match the ids returned by /v1/models.
  • The default model is the top level model key, written as provider/model.

3. Verify the setup

Use this prompt in your configured tool to check authentication, a response and streaming. It reports failures without printing your key.

Open verification prompt
Verification prompt · English
You are working in a repository where I have configured opencode to use Cognitivers as its model provider.

The API is OpenAI-compatible chat completions.

- Base URL: https://api.cognitivers.com/v1
- Streaming: use the same base URL with stream: true
- Models: cog-fast (agents, pipelines, volume), cog-pro (one hard task), cog-embed (retrieval)
- Authentication: an API key in the Authorization header as "Bearer sk-cog-..."

Do these four things and then stop.

1. Check that the credential is present in my environment and tell me the name of the variable you found it in. Do not print the key itself, not even partially.
2. Send one non-streaming chat completion asking for a single short sentence, using cog-fast. Show me the exact command or code you used and the model's reply.
3. Send the same request with streaming enabled and confirm you received server-sent events, not one buffered body.
4. If any step fails, tell me the exact error, the status code and the request that produced it, then stop. Do not try more than two fixes, and do not change any configuration file without showing me the diff first.

Rules: never write the key into a file that is tracked by git, never print it in full, and if the request works, say so in one line instead of writing a report.

5. Confirm which AI SDK package the provider uses. It must be @ai-sdk/openai-compatible for chat completions; @ai-sdk/openai targets a different endpoint and will fail here.

If the check fails, use the reported status code in the error reference and review the compatibility notes above.


Browse all integrations · API quickstart