← All integrations

Use Autark in OpenCode.

OpenCode reads a JSON config file and accepts OpenAI-compatible providers. Add Autark once and its models are selectable everywhere OpenCode picks a model.

Add the provider

OpenCode reads ~/.config/opencode/opencode.json. Add Autark as an OpenAI-compatible provider:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "autark": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Autark",
      "options": {
        "baseURL": "https://api.autark.ai/v1",
        "apiKey": "autark_sk_YOUR_KEY"
      },
      "models": {
        "autark-agent": { "name": "Autark Agent" },
        "autark-pro": { "name": "Autark Pro" },
        "autark-deep": { "name": "Autark Deep" }
      }
    }
  },
  "model": "autark/autark-agent"
}
// Add the -private variants to the models block the same way if you need them.

Verify it works:

opencode run -m autark/autark-agent "say hello"
// Sends one request through Autark.

Troubleshooting

The provider is not listed

Check the file is valid JSON: a trailing comma breaks the whole config silently. Restart OpenCode after editing.

404 on every request

The baseURL is missing /v1. It should be https://api.autark.ai/v1.

Which model should I pick?

Start with autark-agent for interactive work. Move to autark-pro when answers feel shallow, and autark-deep only when the task genuinely needs deep reasoning.