Files
dynagate/free-model-collector.sh
T

66 lines
3.5 KiB
Bash
Raw Normal View History

#!/bin/sh
# Free model collector script for Dynagate
# Depends upon curl, awk and jq
# Created by Luxferre in 2026, released into the public domain
REQ='curl -fsSL'
CONFIG='models.csv'
TCONFIG="$(mktemp)"
# Write OpenCode Zen free models
$REQ https://opencode.ai/zen/v1/models | jq -r '.data | map(select(.id | test("-free")) | .id) | .[]' | awk '{printf "%s,-,https://opencode.ai/zen,\n",$0}' >> "$TCONFIG"
# Write Kilo free models
$REQ https://api.kilo.ai/api/openrouter/models | jq -r '.data | map(select(.isFree) | .id) | .[]' | awk '{printf "%s,-,https://api.kilo.ai/api/openrouter,\n",$0}' >> "$TCONFIG"
# Write Pollinations free model(s)
$REQ https://text.pollinations.ai/models | jq -r 'map(select(.tier=="anonymous") | .name) | .[]' | awk '{printf "%s,-,https://text.pollinations.ai/openai,\n",$0}' >> "$TCONFIG"
# Write OVHCloud free trial models (2 req per minute per IP keyless)
$REQ https://oai.endpoints.kepler.ai.cloud.ovh.net/v1/models | jq -r '.data | .[] | .id' | grep -viE 'diffusion|whisper|ppl|guard|bge-' | awk '{printf "%s,-,https://oai.endpoints.kepler.ai.cloud.ovh.net,\n",$0}' >> "$TCONFIG"
### Uncomment for G4F public-hosted models (50 req per hour per IP keyless)
## Write G4F models (community backend)
#$REQ https://g4f.space/api/community/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/community,\n",$0}' >> "$TCONFIG"
## Write G4F models (gemini-v1beta backend)
#$REQ https://g4f.space/api/gemini-v1beta/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/gemini-v1beta,\n",$0}' >> "$TCONFIG"
## Write G4F models (Qwen backend)
#$REQ https://g4f.space/api/Qwen/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/Qwen,\n",$0}' >> "$TCONFIG"
## Write G4F models (QwenCode backend)
#$REQ https://g4f.space/api/QwenCode/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/QwenCode,\n",$0}' >> "$TCONFIG"
## Write G4F models (GLM backend)
#$REQ https://g4f.space/api/GLM/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/GLM,\n",$0}' >> "$TCONFIG"
## Write G4F models (OpenRouterFree backend)
#$REQ https://g4f.space/api/OpenRouterFree/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/OpenRouterFree,\n",$0}' >> "$TCONFIG"
## Write G4F models (HuggingFace backend)
#$REQ https://g4f.space/api/HuggingFace/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/HuggingFace,\n",$0}' >> "$TCONFIG"
## Write G4F models (HuggingChat backend)
#$REQ https://g4f.space/api/HuggingChat/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/HuggingChat,\n",$0}' >> "$TCONFIG"
## Write G4F models (OpenaiChat backend)
#$REQ https://g4f.space/api/OpenaiChat/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/OpenaiChat,\n",$0}' >> "$TCONFIG"
## Write G4F models (NVidia backend)
#$REQ https://g4f.space/api/nvidia/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/nvidia,\n",$0}' >> "$TCONFIG"
## Write G4F models (Ollama backend)
#$REQ https://g4f.space/api/ollama/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/ollama,\n",$0}' >> "$TCONFIG"
## Write G4F models (Groq backend)
#$REQ https://g4f.space/api/groq/models | jq -r '.data | .[] | .id' | awk '{printf "%s,-,https://g4f.space/api/groq,\n",$0}' >> "$TCONFIG"
# Write the config header
printf 'model,key,endpoint,extra\n' > "$CONFIG"
# Finalize the config
sort -u "$TCONFIG" >> "$CONFIG"
rm -f "$TCONFIG"