Files
public/opencode/README.md
T
ixoblakp cb17ce8d2a feat(opencode): Windows PowerShell installer and Desktop key file
CLI and Desktop share %USERPROFILE%\.config\opencode. Persist the API
key in .arka-api-key so GUI apps do not need a login-shell export.
2026-08-27 18:12:48 +03:00

17 KiB
Raw Blame History

OpenCode и модели Arka AI

Arka AI — OpenAI-совместимый API (https://api.arka-ai.ru/v1). В каталоге models.dev его нет, поэтому в свежем OpenCode провайдера Arka-AI и списка моделей нет, пока не поставить плагин.

Одна команда ставит плагин, skill и (по желанию) ключ. Каталог чат-моделей подтягивается сам (~116 из ~216; без TTS/картинок/видео/эмбеддингов). Снимок каталога обновляется каждый день в 05:00 по Москве.

Нужен API-ключ Arka AI. Секрет ключа показывается один раз при создании.


Быстрый старт

curl -fsSL https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.sh | bash

Скрипт спросит ARKA_API_KEY (можно оставить пустым и задать позже).

Ключ и модель по умолчанию сразу:

curl -fsSL https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.sh \
  | bash -s -- --key "$ARKA_API_KEY" --set-default DeepSeek-V4-Pro

Дальше:

  1. Откройте новый терминал (чтобы подхватился export ARKA_API_KEY).
  2. Перезапустите OpenCode.
  3. Команда /models — в списке должен быть провайдер Arka-AI и чат-модели.

Если OpenCode запущен из GUI / иконки / сокета, а не из login-shell, переменная из ~/.bashrc до него может не дойти. Задайте ARKA_API_KEY в том окружении, откуда стартует OpenCode, или введите ключ в интерактивном приглашении установщика.

Из уже открытого OpenCode

Отдельного магазина плагинов у OpenCode нет. Можно не выходить из CLI: попросите текущую модель (любую, не Arka) выполнить установщик через bash.

Вставьте в чат (подставьте свой ключ):

Поставь провайдер Arka AI для OpenCode. Не спрашивай ключ интерактивно.
Выполни одну команду и покажи вывод:

curl -fsSL https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.sh | bash -s -- --key 'ARKA_API_KEY_HERE' --set-default DeepSeek-V4-Pro

После успеха напиши, что нужно полностью перезапустить OpenCode (конфиг не подхватывается на лету).

Что происходит:

  1. Агент вызывает встроенный bash/shell.
  2. OpenCode спросит разрешение на команду — нажмите Allow.
  3. Скрипт пишет плагин, skill и ключ в ~/.config/opencode (установщик сам по себе офлайн; curl только качает скрипт).
  4. --key обязателен: приглашение «введите ключ» в неинтерактивном пайпе зависнет.
  5. Перезапустите OpenCode целиком — плагин грузится только на старте. Затем /models → Arka-AI.

Пока сессия не перезапущена, разговор идёт на старой модели. Это нормально: установщик не требует Arka.

Windows (CLI и Desktop)

Официальный каталог конфига OpenCode на Windows — %USERPROFILE%\.config\opencode (то же, что C:\Users\<имя>\.config\opencode). Туда же смотрит OpenCode Desktop. Не кладите плагин только в %APPDATA%\opencode — Desktop его оттуда не читает, если этого каталога ещё нет.

PowerShell:

irm https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.ps1 | iex

С ключом и моделью по умолчанию:

iwr -useb https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.ps1 `
  -OutFile $env:TEMP\install-arka.ps1
powershell -ExecutionPolicy Bypass -File $env:TEMP\install-arka.ps1 `
  -Key $env:ARKA_API_KEY -SetDefault DeepSeek-V4-Pro

cmd.exe:

powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.ps1 | iex"

Git Bash / WSL — linux-скрипт, как обычно. Это другой OpenCode (домашний каталог WSL), не native Windows Desktop.

Скрипт пишет:

  • %USERPROFILE%\.config\opencode\plugins\arka-ai.ts
  • %USERPROFILE%\.config\opencode\skills\arka-provider\SKILL.md
  • %USERPROFILE%\.config\opencode\.arka-api-key (Desktop читает ключ отсюда, login-shell не нужен)
  • пользовательскую переменную среды ARKA_API_KEY (подхватится после полного перезапуска GUI)
  • если уже есть %APPDATA%\opencode — копия туда же, на всякий случай

Затем полностью закройте OpenCode Desktop (иконка в трее тоже) и CLI, откройте снова, /models.

OpenCode Desktop (все ОС)

Desktop — это окно + тот же sidecar CLI. Плагины те же файлы, что и у терминала.

ОС Плагин / skill / ключ
Windows %USERPROFILE%\.config\opencode\
macOS / Linux ~/.config/opencode/
  1. Поставьте провайдер скриптом выше (bash или .ps1).
  2. Quit приложения, не только закрытие окна. На Windows проверьте трей.
  3. Запустите Desktop снова. /models → Arka-AI.

~/.bashrc Desktop не читает. Поэтому установщик кладёт ключ в .arka-api-key и (на Windows) в User environment. Если модели есть в списке, но запросы 401 — ключ не попал в процесс: проверьте файл ключа и перезапуск.

Что ставится

Куда Что
~/.config/opencode/plugins/arka-ai.ts Плагин провайдера Arka-AI
~/.config/opencode/skills/arka-provider/SKILL.md Skill: как обновить каталог и сменить модель
~/.bashrc (или первый из .zshrc / .profile) export ARKA_API_KEY=…, если ключ передали
~/.config/opencode/opencode.json Только при --set-default: "model": "Arka-AI/<id>". Существующий конфиг не затирается.

Установщик офлайн и идемпотентный: сеть не трогает, повторный запуск перезаписывает плагин и skill каноническими копиями.

python3 нужен только с --set-default. Отдельный bun на машине не нужен — у OpenCode свой runtime.

Модель по умолчанию

Идентификаторы — как в каталоге, с префиксом провайдера:

{
  "model": "Arka-AI/DeepSeek-V4-Pro"
}

Примеры: Arka-AI/DeepSeek-V4-Pro, Arka-AI/qwen3.8-max, Arka-AI/kimi-k3, Arka-AI/MiniMax-M3, Arka-AI/GLM-5.3, Arka-AI/deepseek-v4-flash-0731.

Их всегда оставляем в списке, даже если фильтр чат-моделей их бы отсёк.

Обновить каталог

rm -f ~/.cache/opencode/arka-ai-models.json

Перезапустите OpenCode. Плагин сначала берёт публичный снимок https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.json (без ключа), при ошибке — живой https://api.arka-ai.ru/v1/models. Локальный кэш живёт 24 часа. Конфиг OpenCode на лету не перечитывается.

Список моделей (ключ не нужен):

curl -sS https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.json | python3 -m json.tool

Вызовы моделей идут на https://api.arka-ai.ru/v1 с ARKA_API_KEY.

Если что-то не так

Симптом Что проверить
После /models нет Arka-AI Есть ли ~/.config/opencode/plugins/arka-ai.ts; экспортирован ли ARKA_API_KEY в процессе OpenCode; открыт ли новый шелл
Каталог не меняется rm -f ~/.cache/opencode/arka-ai-models.json и рестарт
Ошибка импорта плагина Снова запустить установщик — он вернёт канонический файл
curl отдаёт HTML, не скрипт Нужен путь /raw/branch/main/…, не страница репозитория

OpenCode and Arka AI models

Arka AI is an OpenAI-compatible API at https://api.arka-ai.ru/v1. It is not in models.dev, so a fresh OpenCode install has no Arka-AI provider until you add the plugin.

One command installs the plugin, a companion skill, and (optionally) your API key. The chat catalog loads on OpenCode start (~116 of ~216 models; TTS, image, video, and embeddings are filtered out). The published catalog snapshot refreshes daily at 05:00 Europe/Moscow.

You need an Arka AI API key. The secret is shown once at creation.

Quick start

curl -fsSL https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.sh | bash

The script prompts for ARKA_API_KEY (blank is allowed; set it later).

Key and default model in one go:

curl -fsSL https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.sh \
  | bash -s -- --key "$ARKA_API_KEY" --set-default DeepSeek-V4-Pro

Then:

  1. Open a new shell so export ARKA_API_KEY is picked up.
  2. Restart OpenCode.
  3. Run /models — you should see provider Arka-AI and the chat models.

If OpenCode is started from a GUI, dock icon, or socket rather than a login shell, ~/.bashrc may not reach it. Set ARKA_API_KEY in that process environment, or type it at the installer prompt.

From inside OpenCode

OpenCode has no plugin store. You do not have to leave the CLI: ask the current model (any provider, not Arka) to run the installer via bash.

Paste this (put your real key in):

Install the Arka AI OpenCode provider. Do not prompt for the key.
Run this exact command and show the output:

curl -fsSL https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.sh | bash -s -- --key 'ARKA_API_KEY_HERE' --set-default DeepSeek-V4-Pro

When it succeeds, tell me I must fully restart OpenCode (config is not hot-reloaded).

What happens:

  1. The agent uses the built-in bash/shell tool.
  2. OpenCode asks permission — Allow the command.
  3. The script writes the plugin, skill, and key under ~/.config/opencode (the installer itself is offline; curl only fetches the script).
  4. --key is required: the interactive key prompt hangs in a non-interactive pipe.
  5. Fully restart OpenCode — plugins load only at startup. Then /models → Arka-AI.

Until you restart, this session keeps the old model. That is expected: the installer does not need Arka.

Windows (CLI and Desktop)

OpenCode’s real config dir on Windows is %USERPROFILE%\.config\opencode (C:\Users\<name>\.config\opencode). OpenCode Desktop uses that same folder. Putting the plugin only in %APPDATA%\opencode is a common miss — Desktop will not load it unless that directory already exists and happens to be in use.

PowerShell:

irm https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.ps1 | iex

With a key and default model:

iwr -useb https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.ps1 `
  -OutFile $env:TEMP\install-arka.ps1
powershell -ExecutionPolicy Bypass -File $env:TEMP\install-arka.ps1 `
  -Key $env:ARKA_API_KEY -SetDefault DeepSeek-V4-Pro

cmd.exe:

powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.ps1 | iex"

Git Bash / WSL use the Linux installer. That OpenCode is not the native Windows Desktop app (different home directory).

The script writes:

  • %USERPROFILE%\.config\opencode\plugins\arka-ai.ts
  • %USERPROFILE%\.config\opencode\skills\arka-provider\SKILL.md
  • %USERPROFILE%\.config\opencode\.arka-api-key (Desktop reads the key here; no login shell needed)
  • User environment variable ARKA_API_KEY (GUI apps pick this up after a full restart)
  • a copy under %APPDATA%\opencode only if that directory already exists

Then fully quit OpenCode Desktop (tray icon too) and the CLI, start again, /models.

OpenCode Desktop (all platforms)

Desktop is a window plus the same sidecar CLI. Plugins are the same files as the terminal.

OS Plugin / skill / key
Windows %USERPROFILE%\.config\opencode\
macOS / Linux ~/.config/opencode/
  1. Run the installer above (bash or .ps1).
  2. Quit the app, not just the window. On Windows, check the tray.
  3. Start Desktop again. /models → Arka-AI.

Desktop does not read ~/.bashrc. That is why the installer writes .arka-api-key and (on Windows) a User env var. If models show up but requests return 401, the key never reached the process: check the key file and restart.

What the installer writes

Path Role
~/.config/opencode/plugins/arka-ai.ts Arka-AI provider plugin
~/.config/opencode/skills/arka-provider/SKILL.md How to refresh the catalog and change the default model
~/.bashrc (else first existing .zshrc / .profile) export ARKA_API_KEY=… when a key is given
~/.config/opencode/opencode.json Only with --set-default: "model": "Arka-AI/<id>". An existing config is not replaced.

The installer is offline and idempotent: no network calls; re-running overwrites plugin and skill with the canonical copies.

python3 is required only with --set-default. You do not need bun on the host — OpenCode ships its own runtime.

Default model

Use catalog ids with the provider prefix:

{
  "model": "Arka-AI/DeepSeek-V4-Pro"
}

Examples: Arka-AI/DeepSeek-V4-Pro, Arka-AI/qwen3.8-max, Arka-AI/kimi-k3, Arka-AI/MiniMax-M3, Arka-AI/GLM-5.3, Arka-AI/deepseek-v4-flash-0731.

Those ids stay visible even if the chat filter would drop them.

Refresh the catalog

rm -f ~/.cache/opencode/arka-ai-models.json

Restart OpenCode. The plugin fetches the public snapshot https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.json (no key), then falls back to live https://api.arka-ai.ru/v1/models. Local cache TTL is 24 hours. OpenCode does not hot-reload config.

Inspect the published list (no key):

curl -sS https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.json | python3 -m json.tool

Inference still uses ARKA_API_KEY against https://api.arka-ai.ru/v1.

Troubleshooting

Symptom Check
No Arka-AI after /models ~/.config/opencode/plugins/arka-ai.ts exists; ARKA_API_KEY is set in the OpenCode process; you opened a new shell
Models look stale rm -f ~/.cache/opencode/arka-ai-models.json and restart
Plugin import error Re-run the installer to restore the canonical file
curl returns HTML Use /raw/branch/main/…, not the repo page

Files in this folder

File Role
install-arka-provider.sh POSIX installer (macOS/Linux/WSL/Git Bash)
install-arka-provider.ps1 Windows installer (CLI + Desktop)
plugins/arka-ai.ts Plugin source (embedded in the installer)
skills/arka-provider/SKILL.md Skill source (embedded in the installer)
catalog.json Filtered chat catalog, refreshed daily at 05:00 Europe/Moscow
README.md This page — copy into arka-ai.ru «агентные помощники» / agentic helpers

This directory is opencode/ inside the public dump arka/public.