feat: OpenCode Arka-AI installer and daily chat catalog
Public one-liner for opencode. Catalog is the filtered chat list from api.arka-ai.ru/v1/models, refreshed daily at 05:00 Europe/Moscow.
This commit is contained in:
commit
8a4fd6514f
8 files changed
+1175
No files matched your search
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# Daily catalog refresh for arka/public. Runs on core at 05:00 Europe/Moscow.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
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 scripts/sync-catalog.py
|
||||
|
||||
if git diff --quiet -- catalog.json; then
|
||||
printf '%s no catalog change\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git add 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 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())
|
||||
Reference in new issue
Block a user