updated free collector logic for OpenCode

This commit is contained in:
Luxferre
2026-09-11 19:34:39 +03:00
parent 18f9125cb5
commit 20bafb0a14
2 changed files with 37 additions and 28 deletions
+16 -8
View File
@@ -3,12 +3,15 @@
# Depends upon curl and jq
# Created by Luxferre in 2026, released into the public domain
REQ='curl -fsSL'
REQ='curl -fsSL -4'
CONFIG='models.csv'
TCONFIG="$(mktemp)"
# Write OpenCode Zen free models
$REQ https://opencode.ai/zen/v1/models | jq -r '.data[] | select(.id | test("-free")) | "\(.id),-,https://opencode.ai/zen/v1,"' >> "$TCONFIG"
$REQ https://opencode.ai/zen/v1/models | jq -r '.data[] | select(.id | test("-free")) | "\(.id),-,https://opencode.ai/zen/v1,{\"User-Agent\":\"opencode/1.18.30\"}"' >> "$TCONFIG"
# Write Big Pickle as hardcode
echo 'big-pickle,-,https://opencode.ai/zen/v1,{"User-Agent":"opencode/1.18.30"}'>> "$TCONFIG"
# Write Kilo free models
$REQ https://api.kilo.ai/api/gateway/models | jq -r '.data[] | select(.isFree) | "\(.id),-,https://api.kilo.ai/api/gateway,"' >> "$TCONFIG"
@@ -47,6 +50,9 @@ echo 'xortron,-,https://darkc0de-chat.hf.space/v1,'>> "$TCONFIG"
# For non-timeout drops, the HTTP response code is reported for diagnostics.
VCONFIG="$(mktemp)"
SKIPF="$(mktemp)"
# OpenCode Zen endpoints require an X-Session-ID header on chat requests
sid="$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid 2>/dev/null || python3 -c 'import uuid;print(uuid.uuid4())' 2>/dev/null)"
[ -z "$sid" ] && sid="$(head -c 16 /dev/urandom | od -An -tx1 | tr -d ' ')"
while IFS=',' read -r model key endpoint extra; do
[ -z "$model" ] && continue
case "$model" in *embed*) echo "Skipped (embedding model): $model @ $endpoint" >&2; continue;; esac
@@ -54,20 +60,22 @@ while IFS=',' read -r model key endpoint extra; do
echo "Skipped (endpoint unreachable): $model @ $endpoint" >&2
continue
fi
auth=''
[ "$key" != '-' ] && auth="-H Authorization: Bearer $key"
payload="$(jq -nc --arg m "$model" '{model:$m,messages:[{role:"user",content:"Reply with the word OK only."}],max_tokens:8,stream:true}')"
bodyf="$(mktemp)"
# Build curl args as a single-quoted list so each "-H Name: value" stays ONE
# argument. Unquoted variable expansion would word-split "Name: value" and turn
# the value into a stray URL, causing spurious "curl error 6" (couldn't resolve).
set -- -sS -4 -m 8 -o "$bodyf" -w '%{http_code}|%{time_starttransfer}' -X POST "$endpoint/chat/completions" -H 'Content-Type: application/json'
[ "$key" != '-' ] && set -- "$@" -H "Authorization: Bearer $key"
case "$endpoint" in *opencode.ai/zen*) set -- "$@" -H "X-Session-ID: $sid" -H "User-Agent: opencode/1.18.30";; esac
set -- "$@" -d "$payload"
attempt=0
max_attempts=3
ok=0
reason=''
while [ "$attempt" -lt "$max_attempts" ]; do
attempt=$((attempt+1))
out="$(curl -sS -m 8 -o "$bodyf" -w '%{http_code}|%{time_starttransfer}' \
-X POST "$endpoint/chat/completions" \
-H 'Content-Type: application/json' $auth \
-d "$payload" 2>/dev/null)"
out="$(curl "$@" 2>/dev/null)"
rc=$?
http_code="${out%%|*}"
ttft="${out##*|}"
+21 -20
View File
@@ -4,16 +4,17 @@ adept/fuyu-8b,-,https://zsnonsky-nim-proxy.hf.space/v1,
ai21labs/jamba-1.5-large-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
aisingapore/sea-lion-7b-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
bigcode/starcoder2-15b,-,https://zsnonsky-nim-proxy.hf.space/v1,
big-pickle,-,https://opencode.ai/zen/v1,{"User-Agent":"opencode/1.18.30"}
codestral-latest,-,https://api.llm7.io/v1,
cohere/north-mini-code:free,-,https://api.kilo.ai/api/openrouter,
cohere/north-mini-code:free,-,https://api.kilo.ai/api/gateway,
databricks/dbrx-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
deepseek-ai/deepseek-coder-6.7b-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
deepseek-v4-pro,-,https://mmoranguito-openai-nim-proxy.hf.space/v1,
dots-studio/dots-3-note-preview:free,-,https://api.kilo.ai/api/openrouter,
deepseek-ai/deepseek-v4-flash-0731,-,https://garystu-openai-nim-proxy.hf.space/v1,
deepseek-ai/deepseek-v4-flash-0731,-,https://zsnonsky-nim-proxy.hf.space/v1,
dots-studio/dots-3-note-preview:free,-,https://api.kilo.ai/api/gateway,
google/codegemma-1.1-7b,-,https://zsnonsky-nim-proxy.hf.space/v1,
google/codegemma-7b,-,https://zsnonsky-nim-proxy.hf.space/v1,
google/deplot,-,https://zsnonsky-nim-proxy.hf.space/v1,
google/diffusiongemma-26b-a4b-it,-,https://zsnonsky-nim-proxy.hf.space/v1,
google/gemma-2b,-,https://zsnonsky-nim-proxy.hf.space/v1,
google/gemma-3-12b-it,-,https://zsnonsky-nim-proxy.hf.space/v1,
google/gemma-3-4b-it,-,https://zsnonsky-nim-proxy.hf.space/v1,
@@ -22,10 +23,11 @@ ibm/granite-3.0-3b-a800m-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
ibm/granite-3.0-8b-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
ibm/granite-34b-code-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
ibm/granite-8b-code-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
inclusionai/ling-3.0-flash-fin:free,-,https://api.kilo.ai/api/openrouter,
inclusionai/ling-3.0-flash-sante:free,-,https://api.kilo.ai/api/openrouter,
kilo-auto/free,-,https://api.kilo.ai/api/openrouter,
liquid/lfm-2.5-2.6b:free,-,https://api.kilo.ai/api/openrouter,
inclusionai/ling-3.0-flash-fin:free,-,https://api.kilo.ai/api/gateway,
inclusionai/ling-3.0-flash-sante:free,-,https://api.kilo.ai/api/gateway,
inclusionai/ling-3.0-flash-vl:free,-,https://api.kilo.ai/api/gateway,
ling-3.0-flash-fin-free,-,https://opencode.ai/zen/v1,{"User-Agent":"opencode/1.18.30"}
liquid/lfm-2.5-2.6b:free,-,https://api.kilo.ai/api/gateway,
Lorbus/Qwen3.6-27B-int4-AutoRound,-,https://hermes.ai.unturf.com/v1,
meta/codellama-70b,-,https://zsnonsky-nim-proxy.hf.space/v1,
meta/llama2-70b,-,https://zsnonsky-nim-proxy.hf.space/v1,
@@ -34,6 +36,7 @@ meta/muse-glimmer-30b,-,https://zsnonsky-nim-proxy.hf.space/v1,
microsoft/kosmos-2,-,https://zsnonsky-nim-proxy.hf.space/v1,
microsoft/phi-3.5-moe-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
microsoft/phi-3-vision-128k-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
mimo-v2.5-free,-,https://opencode.ai/zen/v1,{"User-Agent":"opencode/1.18.30"}
minimax-m2.7,-,https://api.llm7.io/v1,
mistralai/codestral-22b-instruct-v0.1,-,https://zsnonsky-nim-proxy.hf.space/v1,
mistralai/mistral-7b-instruct-v0.3,-,https://zsnonsky-nim-proxy.hf.space/v1,
@@ -43,9 +46,8 @@ mistralai/mistral-nemotron,-,https://zsnonsky-nim-proxy.hf.space/v1,
mistralai/mixtral-8x22b-v0.1,-,https://zsnonsky-nim-proxy.hf.space/v1,
mistral-Nemo-Instruct-2407,-,https://api.llm7.io/v1,
moonshotai/kimi-k2.6,-,https://zsnonsky-nim-proxy.hf.space/v1,
moonshotai/kimi-k3,-,https://zsnonsky-nim-proxy.hf.space/v1,
nex-agi/nex-n2.5-mini:free,-,https://api.kilo.ai/api/openrouter,
nex-agi/nex-n2.5-pro:free,-,https://api.kilo.ai/api/openrouter,
nex-agi/nex-n2.5-mini:free,-,https://api.kilo.ai/api/gateway,
nex-agi/nex-n2.5-pro:free,-,https://api.kilo.ai/api/gateway,
nvidia/ai-synthetic-video-detector,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/cosmos-reason2-8b,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/ising-calibration-1.5-31b,-,https://zsnonsky-nim-proxy.hf.space/v1,
@@ -57,14 +59,13 @@ nvidia/llama-3.1-nemotron-safety-guard-8b-v3,-,https://zsnonsky-nim-proxy.hf.spa
nvidia/llama-3.1-nemotron-ultra-253b-v1,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/llama3-chatqa-1.5-70b,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/mistral-nemo-minitron-8b-8k-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/nemotron-3.5-content-safety:free,-,https://api.kilo.ai/api/openrouter,
nvidia/nemotron-3.5-content-safety:free,-,https://api.kilo.ai/api/gateway,
nvidia/nemotron-3.5-content-safety,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/nemotron-3.5-lightning:free,-,https://api.kilo.ai/api/openrouter,
nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free,-,https://api.kilo.ai/api/openrouter,
nvidia/nemotron-3.5-lightning:free,-,https://api.kilo.ai/api/gateway,
nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free,-,https://api.kilo.ai/api/gateway,
nvidia/nemotron-3-nano-omni-30b-a3b-reasoning,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/nemotron-3-super-120b-a12b:free,-,https://api.kilo.ai/api/openrouter,
nvidia/nemotron-3-super-120b-a12b:free,-,https://api.kilo.ai/api/gateway,
nvidia/nemotron-3-super-120b-a12b,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/nemotron-3-ultra-550b-a55b,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/nemotron-4-340b-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/nemotron-4-340b-reward,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/nemotron-nano-3-30b-a3b,-,https://zsnonsky-nim-proxy.hf.space/v1,
@@ -76,11 +77,11 @@ nvidia/riva-translate-4b-instruct-v1.1,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/riva-translate-4b-instruct-v2,-,https://zsnonsky-nim-proxy.hf.space/v1,
nvidia/vila,-,https://zsnonsky-nim-proxy.hf.space/v1,
nv-mistralai/mistral-nemo-12b-instruct,-,https://zsnonsky-nim-proxy.hf.space/v1,
openrouter/free,-,https://api.kilo.ai/api/openrouter,
poolside/laguna-s-2.1:free,-,https://api.kilo.ai/api/openrouter,
poolside/laguna-xs-2.1:free,-,https://api.kilo.ai/api/openrouter,
openai/gpt-oss-20b,-,https://zsnonsky-nim-proxy.hf.space/v1,
openrouter/free,-,https://api.kilo.ai/api/gateway,
poolside/laguna-xs-2.1:free,-,https://api.kilo.ai/api/gateway,
poolside/laguna-xs-2.1,-,https://zsnonsky-nim-proxy.hf.space/v1,
stepfun/step-3.7-flash:free,-,https://api.kilo.ai/api/openrouter,
stepfun/step-3.7-flash:free,-,https://api.kilo.ai/api/gateway,
writer/palmyra-creative-122b,-,https://zsnonsky-nim-proxy.hf.space/v1,
writer/palmyra-fin-70b-32k,-,https://zsnonsky-nim-proxy.hf.space/v1,
writer/palmyra-med-70b-32k,-,https://zsnonsky-nim-proxy.hf.space/v1,
Can't render this file because it contains an unexpected character in line 7 and column 42.