Files
public/opencode/skills/arka-provider/SKILL.md
T
ixoblakp ed34998cb7 feat(opencode): support opencode 2.x + generation-aware installer
opencode 2.x changed the plugin API (a plugin must export { id, setup }), so
the 1.x plugin (plugins/arka-ai.ts) no longer loads there and the Arka-AI
provider disappeared ('failed to load plugin').

- install-arka-provider.sh / .ps1 now detect the generation (opencode --version:
  '1.x.y' vs 'opencode v2.x.y'; --gen / -Gen override):
    * 1.x -> install the plugin (dynamic catalog), as before;
    * 2.x -> write a static providers["Arka-AI"] block
      (package @opencode/ai/providers/openai-compatible, settings.baseURL,
      settings.apiKey, models from catalog.json) and disable any stale 1.x plugin.
- --refresh / -Refresh regenerates the 2.x model list (infers generation 2 from
  the installed config); 1.x still clears the cache.
- README + companion skill updated with the 1.x/2.x table, detection, and the
  providers schema.

Verified: gen detection, gen1 plugin write, gen2 providers write (117 models),
merge preserves unrelated keys, stale plugin disabled, refresh keeps the key.
2026-10-27 12:20:31 +03:00

69 lines
2.9 KiB
Markdown

---
name: arka-provider
description: Manage the custom Arka-AI (arka-ai.ru) LLM provider in opencode config (1.x and 2.x). Use when the user needs to add, refresh, or fix the arka-ai.ru provider, sync its model catalog, change the Arka-AI default model, or when arka models are missing from /models.
---
# Arka-AI provider
arka-ai.ru is **not** in models.dev, so opencode ships no built-in config for it.
It is wired up locally. **The mechanism depends on the opencode generation:**
| opencode | provider lives in | models |
|----------|-------------------|--------|
| **1.x** | plugin `~/.config/opencode/plugins/arka-ai.ts` (injects via the `config` hook) | dynamic (public catalog, cached 24h) |
| **2.x** | static `providers["Arka-AI"]` block in `~/.config/opencode/opencode.jsonc` | static list (refresh by re-running the installer) |
`opencode --version` prints `1.x.y` on 1.x and `opencode v2.x.y` on 2.x.
The installer detects this and writes the right thing. (2.x changed the plugin
API: a 1.x plugin no longer loads — it must export `{ id, setup }` — so the 1.x
plugin is disabled and the static block is used instead.)
## 1.x — plugin (dynamic catalog)
- Plugin `plugins/arka-ai.ts` loads the published chat catalog
(`…/opencode/catalog.json`, no key, refreshed daily 05:00 Europe/Moscow), falls
back to `/v1/models`, filters non-chat models, caches at
`~/.cache/opencode/arka-ai-models.json` (TTL 24h), and injects the provider.
- Key: `ARKA_API_KEY` env or `~/.config/opencode/.arka-api-key`.
## 2.x — static config
- `opencode.jsonc` → `providers["Arka-AI"]`:
```jsonc
{
"providers": {
"Arka-AI": {
"name": "Arka-AI",
"package": "@opencode/ai/providers/openai-compatible",
"env": ["ARKA_API_KEY"],
"settings": { "baseURL": "https://api.arka-ai.ru/v1", "apiKey": "…" },
"models": { "DeepSeek-V4-Pro": { "name": "DeepSeek-V4-Pro" } }
}
}
}
```
- The model list is static — refresh it after catalog changes:
```bash
bash install-arka-provider.sh --refresh
```
(re-fetches catalog.json and rewrites only `providers["Arka-AI"].models`).
## Change default model
`"model": "Arka-AI/<model-id>"` in the config file. Use IDs exactly as in the
catalog (e.g. `Arka-AI/DeepSeek-V4-Pro`, `Arka-AI/qwen3.8-max`, `Arka-AI/kimi-k3`).
## Adjust filtering
`NON_CHAT` / `FORCED_MODELS` live in **three** places kept in lockstep:
`opencode/plugins/arka-ai.ts` (1.x), the installer's inline generator (2.x), and
`opencode/scripts/sync-catalog.py` (which rebuilds `catalog.json`). Edit all
three, re-run the installer, restart.
## Probing plan coverage
The public catalog lists every platform model, not your plan's allow-list.
Out-of-plan calls return `400 … does not support using vendor "arka"`. The
allow-list lives only in the admin console (`/admin/data/subscriptions/<id>/edit`).
Optional curated picker: `ARKA_PLAN_MODELS="…"` (1.x plugin only).