refactor: move OpenCode artifacts under opencode/
arka/public is the dump for all Arka downloads. Keep a root stub so the old installer URL still works. Document in-OpenCode bash install.
This commit is contained in:
1 parent
6e0dc4d02b
commit
22938b01ca
9 files changed
+585
-490
No files matched your search
@@ -0,0 +1,237 @@
|
||||
# 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](https://arka-ai.ru/docs/account/api-keys). Секрет ключа показывается **один раз** при создании.
|
||||
|
||||
---
|
||||
|
||||
## Быстрый старт
|
||||
|
||||
```bash
|
||||
curl -fsSL https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/install-arka-provider.sh | bash
|
||||
```
|
||||
|
||||
Скрипт спросит `ARKA_API_KEY` (можно оставить пустым и задать позже).
|
||||
|
||||
Ключ и модель по умолчанию сразу:
|
||||
|
||||
```bash
|
||||
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.
|
||||
|
||||
### Что ставится
|
||||
|
||||
| Куда | Что |
|
||||
|------|-----|
|
||||
| `~/.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.
|
||||
|
||||
### Модель по умолчанию
|
||||
|
||||
Идентификаторы — как в каталоге, с префиксом провайдера:
|
||||
|
||||
```json
|
||||
{
|
||||
"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`.
|
||||
|
||||
Их всегда оставляем в списке, даже если фильтр чат-моделей их бы отсёк.
|
||||
|
||||
### Обновить каталог
|
||||
|
||||
```bash
|
||||
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 на лету не перечитывается.
|
||||
|
||||
Список моделей (ключ не нужен):
|
||||
|
||||
```bash
|
||||
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](https://arka-ai.ru/docs/account/api-keys). The secret is shown **once** at creation.
|
||||
|
||||
## Quick start
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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.
|
||||
|
||||
### 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:
|
||||
|
||||
```json
|
||||
{
|
||||
"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
|
||||
|
||||
```bash
|
||||
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):
|
||||
|
||||
```bash
|
||||
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` | Self-contained installer (the one-liner) |
|
||||
| `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](https://git.arka-ai.ru/arka/public).
|
||||
@@ -0,0 +1,473 @@
|
||||
{
|
||||
"updated_at": "2026-08-27T14:11:53Z",
|
||||
"source": "https://api.arka-ai.ru/v1/models",
|
||||
"raw_count": 216,
|
||||
"chat_count": 116,
|
||||
"object": "list",
|
||||
"data": [
|
||||
{
|
||||
"id": "ACE-Step-v1-3.5B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Align-DS-V",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "AnimeSharp",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "AutoGLM-Phone-9B-Multilingual",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DeepSeek-Prover-V2-7B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DeepSeek-R1",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DeepSeek-R1-Distill-Qwen-1.5B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DeepSeek-R1-Distill-Qwen-14B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DeepSeek-R1-Distill-Qwen-32B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DeepSeek-R1-Distill-Qwen-7B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DeepSeek-V3",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DeepSeek-V3.2",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DeepSeek-V3_1",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DeepSeek-V3_1-Terminus",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DeepSeek-V4-Pro",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "DianJin-R1-32B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Duix.Heygem",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "ERNIE-4.5-Turbo",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "ERNIE-4.5-Turbo-VL",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "ERNIE-5.0-Thinking",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "ERNIE-X1-Turbo",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Fin-R1",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-4-32B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-4-9B-0414",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-4.6",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-4.7",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-4.7-Flash",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-4_5",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-4_5-Air",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-4_5V",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-5",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-5.1",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-5.2",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "GLM-5.3",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "HY-MT1.5-7B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "HappyHorse-1.0",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "HealthGPT-L14",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Hi3DGen",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "HiDream-I1-Full",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "HuatuoGPT-o1-7B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Hunyuan3D-2",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "InfiniteTalk",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "InternVL2-8B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "InternVL3-38B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "InternVL3-78B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "KAT-Dev",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Kimi-K2.5",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Kimi-K2.7-Code",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "LTX-2",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "LegalOne-8B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Lingshu-32B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "MAI-UI-8B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "MiMo-V2.5-Pro",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "MinerU2.5",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "MinerU2.5-Pro",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "MiniMax-M2.1",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "MiniMax-M2.5",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "MiniMax-M2.7",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "MiniMax-M3",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "PDF-Extract-Kit-1.0",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "QwQ-32B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen2-7B-Instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen2-VL-72B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen2.5-14B-Instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen2.5-7B-Instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen2.5-Coder-32B-Instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-0.6B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-14B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-30B-A3B-Instruct-2507",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-32B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-4B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-8B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-Coder-30B-A3B-Instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-Coder-Flash",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-Coder-Next",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-Next-80B-A3B-Instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-Next-80B-A3B-Thinking",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-VL-235B-A22B-Instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-VL-235B-A22B-Thinking",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-VL-30B-A3B-Instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-VL-32B-Instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-VL-32B-Thinking",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-VL-4B-Instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-VL-8B-Instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3-VL-8B-Thinking",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.5-122B-A10B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.5-27B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.5-27B-Claude-4.6-Opus-Reasoning-Distilled",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.5-9B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.5-Flash",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.5-Plus",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.6-27B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.6-35B-A3B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.6-Flash",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.6-Max",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.6-Plus",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.7-Max",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3.7-Plus",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3Guard-Gen-0.6B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3Guard-Gen-4B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Qwen3Guard-Gen-8B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "SeedVR2-3B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Sinong1.0-32B",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "Step-3.7-Flash",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "UVDoc",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "VajraV1",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "deepseek-coder-33B-instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "deepseek-v4-flash-0731",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "gemma-4-26B-A4B-it",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "glm-4-9b-chat",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "gpt-oss-120b",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "happyhorse-1.1",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "internlm3-8b-instruct",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "kimi-k3",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "nonescape-v0",
|
||||
"object": "model"
|
||||
},
|
||||
{
|
||||
"id": "qwen3.8-max",
|
||||
"object": "model"
|
||||
}
|
||||
]
|
||||
}
|
||||
Executable
+304
@@ -0,0 +1,304 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# install-arka-provider.sh — one-shot installer for the arka-ai.ru LLM provider
|
||||
# in a fresh opencode install.
|
||||
#
|
||||
# It is fully self-contained: it embeds the provider plugin and the companion
|
||||
# skill, writes them into ~/.config/opencode, and persists ARKA_API_KEY.
|
||||
#
|
||||
# Usage:
|
||||
# bash install-arka-provider.sh # prompt for API key
|
||||
# ARKA_API_KEY=xxx bash install-arka-provider.sh # key from env (no prompt)
|
||||
# bash install-arka-provider.sh --key xxx --set-default DeepSeek-V4-Pro
|
||||
#
|
||||
# Options:
|
||||
# --key KEY ARKA_API_KEY to persist (default: $ARKA_API_KEY, else prompt)
|
||||
# --set-default MODEL also set "model": "Arka-AI/<MODEL>" in opencode.json
|
||||
# -h, --help show this help
|
||||
#
|
||||
# Idempotent: safe to run multiple times. Overwrites plugin/skill with the
|
||||
# embedded versions; never clobbers an existing opencode.json (only upserts the
|
||||
# requested default model). Makes no network calls.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
sed -n '2,21p' "$0"
|
||||
}
|
||||
|
||||
KEY=""
|
||||
MODEL=""
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--key) KEY="$2"; shift 2 ;;
|
||||
--key=*) KEY="${1#*=}"; shift ;;
|
||||
--set-default) MODEL="$2"; shift 2 ;;
|
||||
--set-default=*) MODEL="${1#*=}"; shift ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) printf 'unknown option: %s\n' "$1" >&2; usage; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
CONF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/opencode"
|
||||
PLUGIN_DIR="$CONF_DIR/plugins"
|
||||
SKILL_DIR="$CONF_DIR/skills/arka-provider"
|
||||
|
||||
mkdir -p "$PLUGIN_DIR" "$SKILL_DIR" "$HOME"
|
||||
|
||||
echo "==> writing provider plugin to $PLUGIN_DIR/arka-ai.ts"
|
||||
cat > "$PLUGIN_DIR/arka-ai.ts" <<'PLUGIN'
|
||||
import { homedir } from "node:os"
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"
|
||||
import { join } from "node:path"
|
||||
|
||||
const PROVIDER_ID = "Arka-AI"
|
||||
const API_URL = "https://api.arka-ai.ru/v1"
|
||||
const CATALOG_URL =
|
||||
"https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.json"
|
||||
const CACHE_FILE = join(homedir(), ".cache", "opencode", "arka-ai-models.json")
|
||||
const TTL_MS = 24 * 60 * 60 * 1000
|
||||
|
||||
// Ids that must always be exposed, even if the filter would drop them.
|
||||
const FORCED_MODELS = [
|
||||
"DeepSeek-V4-Pro",
|
||||
"deepseek-v4-flash-0731",
|
||||
"qwen3.8-max",
|
||||
"kimi-k3",
|
||||
"MiniMax-M3",
|
||||
"GLM-5.3",
|
||||
]
|
||||
|
||||
// Heuristic: drop non-chat models (TTS/ASR/image/video/OCR/embeddings/rerankers…)
|
||||
// from the catalog so they don't clutter the /models picker.
|
||||
// Keep in sync with scripts/sync-catalog.py
|
||||
const NON_CHAT = new RegExp(
|
||||
[
|
||||
"tts", "asr", "audio", "speech", "voice", "whisper", "sensevoice",
|
||||
"image", "(^|[.-])img", "wan", "vidu", "video", "sora", "flux",
|
||||
"diffus", "kolors", "cogview", "ocr", "embedding", "(^|[.-])embed",
|
||||
"rerank", "clip", "moderation", "(^|[.-])filter", "detect", "classif",
|
||||
"(^|[.-])location", "(^|[.-])search", "comfyui", "meme", "hello",
|
||||
"(^|[.-])sam", "florence", "esrgan", "rmbg", "background", "poster",
|
||||
"(^|[.-])face", "(^|[.-])lip", "translate", "(^|[.-])mt([2-]|$)",
|
||||
"(^|[.-])bge", "(^|[.-])e5", "(^|[.-])jina", "(^|[.-])mpnet",
|
||||
"spark-tts", "cosyvoice", "chattts", "indextts", "step-audio",
|
||||
"fish-speech", "cosy", "mate-gguf", "tokenizer",
|
||||
].join("|"),
|
||||
"i",
|
||||
)
|
||||
|
||||
type ModelMap = Record<string, { name: string }>
|
||||
type Cache = { ts: number; models: ModelMap }
|
||||
|
||||
function loadCache(): Cache | null {
|
||||
try {
|
||||
if (existsSync(CACHE_FILE)) return JSON.parse(readFileSync(CACHE_FILE, "utf8"))
|
||||
} catch {}
|
||||
return null
|
||||
}
|
||||
|
||||
function saveCache(models: ModelMap): void {
|
||||
try {
|
||||
mkdirSync(join(homedir(), ".cache", "opencode"), { recursive: true })
|
||||
writeFileSync(CACHE_FILE, JSON.stringify({ ts: Date.now(), models }))
|
||||
} catch {}
|
||||
}
|
||||
|
||||
async function fetchJson(
|
||||
url: string,
|
||||
headers: Record<string, string>,
|
||||
timeoutMs: number,
|
||||
): Promise<unknown> {
|
||||
const ctrl = new AbortController()
|
||||
const timer = setTimeout(() => ctrl.abort(), timeoutMs)
|
||||
try {
|
||||
const res = await fetch(url, { headers, signal: ctrl.signal })
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
||||
return await res.json()
|
||||
} finally {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
}
|
||||
|
||||
function idsFromPayload(json: unknown): string[] {
|
||||
const data = (json as { data?: Array<{ id: string }> }).data
|
||||
return (data ?? []).map((m) => m.id).filter(Boolean)
|
||||
}
|
||||
|
||||
function toModelMap(ids: string[], filter: boolean): ModelMap {
|
||||
const models: ModelMap = {}
|
||||
for (const id of ids) {
|
||||
if (!filter || FORCED_MODELS.includes(id) || !NON_CHAT.test(id)) {
|
||||
models[id] = { name: id }
|
||||
}
|
||||
}
|
||||
return models
|
||||
}
|
||||
|
||||
async function resolveModels(): Promise<ModelMap | null> {
|
||||
const cache = loadCache()
|
||||
if (cache && Date.now() - cache.ts < TTL_MS) return cache.models
|
||||
|
||||
try {
|
||||
const models = toModelMap(idsFromPayload(await fetchJson(CATALOG_URL, {}, 5000)), false)
|
||||
if (Object.keys(models).length) {
|
||||
saveCache(models)
|
||||
return models
|
||||
}
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
const key = process.env.ARKA_API_KEY
|
||||
const json = await fetchJson(
|
||||
`${API_URL}/models`,
|
||||
key ? { Authorization: `Bearer ${key}` } : {},
|
||||
5000,
|
||||
)
|
||||
const models = toModelMap(idsFromPayload(json), true)
|
||||
saveCache(models)
|
||||
return models
|
||||
} catch {
|
||||
return cache?.models ?? null
|
||||
}
|
||||
}
|
||||
|
||||
export default async function ArkaAIProviderPlugin() {
|
||||
const models = await resolveModels()
|
||||
|
||||
return {
|
||||
config: (cfg: any) => {
|
||||
cfg.provider ??= {}
|
||||
const prev = cfg.provider[PROVIDER_ID] ?? {}
|
||||
|
||||
// Static models from opencode.json act as a fallback; the fetched
|
||||
// catalog is layered on top so the configured default model never
|
||||
// disappears even if the catalog drops it.
|
||||
cfg.provider[PROVIDER_ID] = {
|
||||
name: "Arka-AI",
|
||||
api: API_URL,
|
||||
env: ["ARKA_API_KEY"],
|
||||
...prev,
|
||||
models: { ...(prev.models ?? {}), ...(models ?? {}) },
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
PLUGIN
|
||||
|
||||
echo "==> writing companion skill to $SKILL_DIR/SKILL.md"
|
||||
cat > "$SKILL_DIR/SKILL.md" <<'SKILL'
|
||||
---
|
||||
name: arka-provider
|
||||
description: Manage the custom Arka-AI (arka-ai.ru) LLM provider in opencode config. 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 with a plugin + a static `provider` block in
|
||||
`~/.config/opencode/opencode.json`.
|
||||
|
||||
## How it works
|
||||
|
||||
- Plugin: `~/.config/opencode/plugins/arka-ai.ts`
|
||||
- On startup it loads the published chat catalog
|
||||
`https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.json`
|
||||
(no API key; refreshed daily at 05:00 Europe/Moscow).
|
||||
- If that fetch fails, it falls back to `https://api.arka-ai.ru/v1/models`
|
||||
and filters out non-chat models (TTS/ASR/image/video/OCR/embedding/reranker/…)
|
||||
via a heuristic regex so the `/models` picker stays clean.
|
||||
- Caches the result at `~/.cache/opencode/arka-ai-models.json` (TTL 24h).
|
||||
- Injects the provider into config via the `config` hook, layered over the
|
||||
static block in `opencode.json`.
|
||||
- Static block (`opencode.json` → `provider["Arka-AI"]`) holds
|
||||
`name`, `api`, `env`, and a small fallback `models` map that is used when the
|
||||
catalog is unreachable.
|
||||
- Inference still uses `ARKA_API_KEY` against `https://api.arka-ai.ru/v1`.
|
||||
|
||||
## Refresh the model list
|
||||
|
||||
Catalog ~216 raw models / ~116 chat; the public snapshot updates at 05:00
|
||||
Europe/Moscow. Changes land in opencode only after cache expiry + restart
|
||||
(config is not hot-reloaded).
|
||||
|
||||
1. `rm -f ~/.cache/opencode/arka-ai-models.json`
|
||||
2. Restart opencode (or run `opencode` again) — the plugin re-fetches on the
|
||||
next cold start.
|
||||
|
||||
Optionally inspect the live API (no key required for listing):
|
||||
|
||||
```bash
|
||||
curl -sS https://api.arka-ai.ru/v1/models | python3 -m json.tool
|
||||
curl -sS https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.json | python3 -m json.tool
|
||||
```
|
||||
|
||||
## Change default model
|
||||
|
||||
Edit `opencode.json` → `"model": "Arka-AI/<model-id>"`. Use the IDs exactly as
|
||||
returned by the catalog (e.g. `Arka-AI/DeepSeek-V4-Pro`,
|
||||
`Arka-AI/qwen3.8-max`, `Arka-AI/kimi-k3`).
|
||||
|
||||
## Adjust filtering
|
||||
|
||||
Edit `NON_CHAT` (regex) or `FORCED_MODELS` in the plugin file **and** the same
|
||||
lists in `scripts/sync-catalog.py` in `arka/public`, then re-run the installer
|
||||
and restart. `FORCED_MODELS` keeps must-have chat models even if the heuristic
|
||||
would drop them.
|
||||
SKILL
|
||||
|
||||
# --- API key -----------------------------------------------------------
|
||||
|
||||
if [ -z "$KEY" ]; then
|
||||
read -rsp "ARKA_API_KEY (leave blank to skip): " KEY || true
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ -n "$KEY" ]; then
|
||||
RC=""
|
||||
for f in "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.profile"; do
|
||||
if [ -f "$f" ]; then RC="$f"; break; fi
|
||||
done
|
||||
RC="${RC:-$HOME/.bashrc}"
|
||||
touch "$RC"
|
||||
if grep -q 'ARKA_API_KEY' "$RC"; then
|
||||
echo "==> ARKA_API_KEY already present in $RC (skipped)"
|
||||
else
|
||||
printf '\n# opencode Arka-AI provider\nexport ARKA_API_KEY="%s"\n' "$KEY" >> "$RC"
|
||||
echo "==> wrote ARKA_API_KEY to $RC"
|
||||
fi
|
||||
export ARKA_API_KEY="$KEY"
|
||||
else
|
||||
echo "==> warning: no ARKA_API_KEY set; export it in your shell before starting opencode" >&2
|
||||
fi
|
||||
|
||||
# --- default model (optional) ------------------------------------------
|
||||
|
||||
if [ -n "$MODEL" ]; then
|
||||
CONF="$CONF_DIR/opencode.json"
|
||||
echo "==> setting default model Arka-AI/$MODEL in $CONF"
|
||||
python3 - "$CONF" "Arka-AI/$MODEL" <<'PY'
|
||||
import json, os, sys
|
||||
|
||||
path, model = sys.argv[1], sys.argv[2]
|
||||
data = {}
|
||||
if os.path.exists(path):
|
||||
with open(path) as f:
|
||||
data = json.load(f)
|
||||
data.setdefault("$schema", "https://opencode.ai/config.json")
|
||||
data["model"] = model
|
||||
with open(path, "w") as f:
|
||||
json.dump(data, f, indent=2)
|
||||
f.write("\n")
|
||||
PY
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Done."
|
||||
echo " - provider plugin: $PLUGIN_DIR/arka-ai.ts"
|
||||
echo " - skill: $SKILL_DIR/SKILL.md"
|
||||
echo
|
||||
echo "Next steps:"
|
||||
echo " 1. Restart opencode (open a new shell so ARKA_API_KEY is exported)."
|
||||
echo " 2. Run /models — the Arka-AI catalog (~116 chat models) loads on first start."
|
||||
echo " 3. Optional: refresh catalog later with: rm -f ~/.cache/opencode/arka-ai-models.json"
|
||||
@@ -0,0 +1,136 @@
|
||||
import { homedir } from "node:os"
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"
|
||||
import { join } from "node:path"
|
||||
|
||||
const PROVIDER_ID = "Arka-AI"
|
||||
const API_URL = "https://api.arka-ai.ru/v1"
|
||||
const CATALOG_URL =
|
||||
"https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.json"
|
||||
const CACHE_FILE = join(homedir(), ".cache", "opencode", "arka-ai-models.json")
|
||||
const TTL_MS = 24 * 60 * 60 * 1000
|
||||
|
||||
// Ids that must always be exposed, even if the filter would drop them.
|
||||
const FORCED_MODELS = [
|
||||
"DeepSeek-V4-Pro",
|
||||
"deepseek-v4-flash-0731",
|
||||
"qwen3.8-max",
|
||||
"kimi-k3",
|
||||
"MiniMax-M3",
|
||||
"GLM-5.3",
|
||||
]
|
||||
|
||||
// Heuristic: drop non-chat models (TTS/ASR/image/video/OCR/embeddings/rerankers…)
|
||||
// from the catalog so they don't clutter the /models picker.
|
||||
// Keep in sync with scripts/sync-catalog.py
|
||||
const NON_CHAT = new RegExp(
|
||||
[
|
||||
"tts", "asr", "audio", "speech", "voice", "whisper", "sensevoice",
|
||||
"image", "(^|[.-])img", "wan", "vidu", "video", "sora", "flux",
|
||||
"diffus", "kolors", "cogview", "ocr", "embedding", "(^|[.-])embed",
|
||||
"rerank", "clip", "moderation", "(^|[.-])filter", "detect", "classif",
|
||||
"(^|[.-])location", "(^|[.-])search", "comfyui", "meme", "hello",
|
||||
"(^|[.-])sam", "florence", "esrgan", "rmbg", "background", "poster",
|
||||
"(^|[.-])face", "(^|[.-])lip", "translate", "(^|[.-])mt([2-]|$)",
|
||||
"(^|[.-])bge", "(^|[.-])e5", "(^|[.-])jina", "(^|[.-])mpnet",
|
||||
"spark-tts", "cosyvoice", "chattts", "indextts", "step-audio",
|
||||
"fish-speech", "cosy", "mate-gguf", "tokenizer",
|
||||
].join("|"),
|
||||
"i",
|
||||
)
|
||||
|
||||
type ModelMap = Record<string, { name: string }>
|
||||
type Cache = { ts: number; models: ModelMap }
|
||||
|
||||
function loadCache(): Cache | null {
|
||||
try {
|
||||
if (existsSync(CACHE_FILE)) return JSON.parse(readFileSync(CACHE_FILE, "utf8"))
|
||||
} catch {}
|
||||
return null
|
||||
}
|
||||
|
||||
function saveCache(models: ModelMap): void {
|
||||
try {
|
||||
mkdirSync(join(homedir(), ".cache", "opencode"), { recursive: true })
|
||||
writeFileSync(CACHE_FILE, JSON.stringify({ ts: Date.now(), models }))
|
||||
} catch {}
|
||||
}
|
||||
|
||||
async function fetchJson(
|
||||
url: string,
|
||||
headers: Record<string, string>,
|
||||
timeoutMs: number,
|
||||
): Promise<unknown> {
|
||||
const ctrl = new AbortController()
|
||||
const timer = setTimeout(() => ctrl.abort(), timeoutMs)
|
||||
try {
|
||||
const res = await fetch(url, { headers, signal: ctrl.signal })
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
||||
return await res.json()
|
||||
} finally {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
}
|
||||
|
||||
function idsFromPayload(json: unknown): string[] {
|
||||
const data = (json as { data?: Array<{ id: string }> }).data
|
||||
return (data ?? []).map((m) => m.id).filter(Boolean)
|
||||
}
|
||||
|
||||
function toModelMap(ids: string[], filter: boolean): ModelMap {
|
||||
const models: ModelMap = {}
|
||||
for (const id of ids) {
|
||||
if (!filter || FORCED_MODELS.includes(id) || !NON_CHAT.test(id)) {
|
||||
models[id] = { name: id }
|
||||
}
|
||||
}
|
||||
return models
|
||||
}
|
||||
|
||||
async function resolveModels(): Promise<ModelMap | null> {
|
||||
const cache = loadCache()
|
||||
if (cache && Date.now() - cache.ts < TTL_MS) return cache.models
|
||||
|
||||
try {
|
||||
const models = toModelMap(idsFromPayload(await fetchJson(CATALOG_URL, {}, 5000)), false)
|
||||
if (Object.keys(models).length) {
|
||||
saveCache(models)
|
||||
return models
|
||||
}
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
const key = process.env.ARKA_API_KEY
|
||||
const json = await fetchJson(
|
||||
`${API_URL}/models`,
|
||||
key ? { Authorization: `Bearer ${key}` } : {},
|
||||
5000,
|
||||
)
|
||||
const models = toModelMap(idsFromPayload(json), true)
|
||||
saveCache(models)
|
||||
return models
|
||||
} catch {
|
||||
return cache?.models ?? null
|
||||
}
|
||||
}
|
||||
|
||||
export default async function ArkaAIProviderPlugin() {
|
||||
const models = await resolveModels()
|
||||
|
||||
return {
|
||||
config: (cfg: any) => {
|
||||
cfg.provider ??= {}
|
||||
const prev = cfg.provider[PROVIDER_ID] ?? {}
|
||||
|
||||
// Static models from opencode.json act as a fallback; the fetched
|
||||
// catalog is layered on top so the configured default model never
|
||||
// disappears even if the catalog drops it.
|
||||
cfg.provider[PROVIDER_ID] = {
|
||||
name: "Arka-AI",
|
||||
api: API_URL,
|
||||
env: ["ARKA_API_KEY"],
|
||||
...prev,
|
||||
models: { ...(prev.models ?? {}), ...(models ?? {}) },
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# Daily catalog refresh for arka/public/opencode.
|
||||
# Runs on core at 05:00 Europe/Moscow.
|
||||
set -euo pipefail
|
||||
|
||||
# this file lives at opencode/scripts/cron-sync.sh → repo root is ../..
|
||||
REPO="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
cd "$REPO"
|
||||
|
||||
export GIT_SSH_COMMAND="${GIT_SSH_COMMAND:-ssh -i /root/.ssh/arka_public_catalog -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new}"
|
||||
|
||||
git fetch origin main
|
||||
git checkout -q main
|
||||
git reset --hard origin/main
|
||||
|
||||
python3 opencode/scripts/sync-catalog.py
|
||||
|
||||
if git diff --quiet -- opencode/catalog.json; then
|
||||
printf '%s no catalog change\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git add opencode/catalog.json
|
||||
git -c user.name='arka-catalog-bot' -c user.email='noreply@arka-ai.ru' \
|
||||
commit -m "chore(catalog): refresh $(date -u +%Y-%m-%d)"
|
||||
git push origin main
|
||||
printf '%s catalog pushed\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
Executable
+129
@@ -0,0 +1,129 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Rebuild catalog.json from the public arka-ai.ru OpenAI-compatible models list.
|
||||
|
||||
Keep FORCED_MODELS / NON_CHAT in lockstep with opencode/plugins/arka-ai.ts.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
import urllib.request
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
API_URL = "https://api.arka-ai.ru/v1/models"
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
OUT = ROOT / "catalog.json"
|
||||
|
||||
FORCED_MODELS = [
|
||||
"DeepSeek-V4-Pro",
|
||||
"deepseek-v4-flash-0731",
|
||||
"qwen3.8-max",
|
||||
"kimi-k3",
|
||||
"MiniMax-M3",
|
||||
"GLM-5.3",
|
||||
]
|
||||
|
||||
NON_CHAT = re.compile(
|
||||
"|".join(
|
||||
[
|
||||
"tts",
|
||||
"asr",
|
||||
"audio",
|
||||
"speech",
|
||||
"voice",
|
||||
"whisper",
|
||||
"sensevoice",
|
||||
"image",
|
||||
r"(^|[.-])img",
|
||||
"wan",
|
||||
"vidu",
|
||||
"video",
|
||||
"sora",
|
||||
"flux",
|
||||
"diffus",
|
||||
"kolors",
|
||||
"cogview",
|
||||
"ocr",
|
||||
"embedding",
|
||||
r"(^|[.-])embed",
|
||||
"rerank",
|
||||
"clip",
|
||||
"moderation",
|
||||
r"(^|[.-])filter",
|
||||
"detect",
|
||||
"classif",
|
||||
r"(^|[.-])location",
|
||||
r"(^|[.-])search",
|
||||
"comfyui",
|
||||
"meme",
|
||||
"hello",
|
||||
r"(^|[.-])sam",
|
||||
"florence",
|
||||
"esrgan",
|
||||
"rmbg",
|
||||
"background",
|
||||
"poster",
|
||||
r"(^|[.-])face",
|
||||
r"(^|[.-])lip",
|
||||
"translate",
|
||||
r"(^|[.-])mt([2-]|$)",
|
||||
r"(^|[.-])bge",
|
||||
r"(^|[.-])e5",
|
||||
r"(^|[.-])jina",
|
||||
r"(^|[.-])mpnet",
|
||||
"spark-tts",
|
||||
"cosyvoice",
|
||||
"chattts",
|
||||
"indextts",
|
||||
"step-audio",
|
||||
"fish-speech",
|
||||
"cosy",
|
||||
"mate-gguf",
|
||||
"tokenizer",
|
||||
]
|
||||
),
|
||||
re.I,
|
||||
)
|
||||
|
||||
|
||||
def fetch_models() -> list[dict]:
|
||||
req = urllib.request.Request(API_URL, headers={"User-Agent": "arka-public-catalog-sync"})
|
||||
with urllib.request.urlopen(req, timeout=30) as resp:
|
||||
payload = json.load(resp)
|
||||
data = payload.get("data") or []
|
||||
if not isinstance(data, list) or not data:
|
||||
raise SystemExit("empty models list from api.arka-ai.ru")
|
||||
return data
|
||||
|
||||
|
||||
def keep(item: dict) -> bool:
|
||||
mid = item.get("id") or ""
|
||||
return mid in FORCED_MODELS or not NON_CHAT.search(mid)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
raw = fetch_models()
|
||||
chat = [item for item in raw if keep(item)]
|
||||
chat.sort(key=lambda item: item.get("id") or "")
|
||||
missing = [mid for mid in FORCED_MODELS if not any(item.get("id") == mid for item in chat)]
|
||||
if missing:
|
||||
print("warning: forced models missing from catalog:", ", ".join(missing), file=sys.stderr)
|
||||
|
||||
out = {
|
||||
"updated_at": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
|
||||
"source": API_URL,
|
||||
"raw_count": len(raw),
|
||||
"chat_count": len(chat),
|
||||
"object": "list",
|
||||
"data": [{"id": item.get("id"), "object": "model"} for item in chat],
|
||||
}
|
||||
text = json.dumps(out, ensure_ascii=False, indent=2) + "\n"
|
||||
OUT.write_text(text, encoding="utf-8")
|
||||
print(f"wrote {OUT} raw={out['raw_count']} chat={out['chat_count']}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,57 @@
|
||||
---
|
||||
name: arka-provider
|
||||
description: Manage the custom Arka-AI (arka-ai.ru) LLM provider in opencode config. 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 with a plugin + a static `provider` block in
|
||||
`~/.config/opencode/opencode.json`.
|
||||
|
||||
## How it works
|
||||
|
||||
- Plugin: `~/.config/opencode/plugins/arka-ai.ts`
|
||||
- On startup it loads the published chat catalog
|
||||
`https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.json`
|
||||
(no API key; refreshed daily at 05:00 Europe/Moscow).
|
||||
- If that fetch fails, it falls back to `https://api.arka-ai.ru/v1/models`
|
||||
and filters out non-chat models (TTS/ASR/image/video/OCR/embedding/reranker/…)
|
||||
via a heuristic regex so the `/models` picker stays clean.
|
||||
- Caches the result at `~/.cache/opencode/arka-ai-models.json` (TTL 24h).
|
||||
- Injects the provider into config via the `config` hook, layered over the
|
||||
static block in `opencode.json`.
|
||||
- Static block (`opencode.json` → `provider["Arka-AI"]`) holds
|
||||
`name`, `api`, `env`, and a small fallback `models` map that is used when the
|
||||
catalog is unreachable.
|
||||
- Inference still uses `ARKA_API_KEY` against `https://api.arka-ai.ru/v1`.
|
||||
|
||||
## Refresh the model list
|
||||
|
||||
Catalog ~216 raw models / ~116 chat; the public snapshot updates at 05:00
|
||||
Europe/Moscow. Changes land in opencode only after cache expiry + restart
|
||||
(config is not hot-reloaded).
|
||||
|
||||
1. `rm -f ~/.cache/opencode/arka-ai-models.json`
|
||||
2. Restart opencode (or run `opencode` again) — the plugin re-fetches on the
|
||||
next cold start.
|
||||
|
||||
Optionally inspect the live API (no key required for listing):
|
||||
|
||||
```bash
|
||||
curl -sS https://api.arka-ai.ru/v1/models | python3 -m json.tool
|
||||
curl -sS https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.json | python3 -m json.tool
|
||||
```
|
||||
|
||||
## Change default model
|
||||
|
||||
Edit `opencode.json` → `"model": "Arka-AI/<model-id>"`. Use the IDs exactly as
|
||||
returned by the catalog (e.g. `Arka-AI/DeepSeek-V4-Pro`,
|
||||
`Arka-AI/qwen3.8-max`, `Arka-AI/kimi-k3`).
|
||||
|
||||
## Adjust filtering
|
||||
|
||||
Edit `NON_CHAT` (regex) or `FORCED_MODELS` in the plugin file **and** the same
|
||||
lists in `scripts/sync-catalog.py` in `arka/public`, then re-run the installer
|
||||
and restart. `FORCED_MODELS` keeps must-have chat models even if the heuristic
|
||||
would drop them.
|
||||
Reference in new issue
Block a user