utils/omniroute_offload/bin/claude-free
Krzysztof kuhy Rudnicki c2165e9fb8
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
omniroute_offload pre-commit / pre-commit (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
omniroute_offload: free-llm, claude-free
free-llm sends big texts to the free-best OmniRoute chain behind a
fail-closed privacy gate (public repos, /tmp, /var/log; credential
scan). claude-free runs Claude Code with the full ~/.claude setup on
free-best. Skill offload-free in ~/.claude says when to use them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWYwGi2FJwfZ6QRB1im
2026-11-05 13:14:16 +01:00

26 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Claude Code with your full ~/.claude setup, but every model (main, subagents,
# background) is the free-best chain on the local OmniRoute gateway. Free providers log
# prompts, so it refuses to start outside public repos unless --force.
set -euo pipefail
readonly GW="http://127.0.0.1:20128"
readonly MODEL="${CLAUDE_FREE_MODEL:-free-best}"
KEY="$(cat "${HOME}/.config/omniroute/api_key")"
readonly KEY
if [[ "${1:-}" == --force ]]; then
shift
else
free-llm-check-dir . || { echo "claude-free: only public repos, /tmp, /var/log (or --force)" >&2; exit 2; }
fi
curl -fsS -m 3 -o /dev/null "${GW}/v1/models" -H "Authorization: Bearer ${KEY}" ||
{ echo "claude-free: gateway down; run ~/src/omniroute-tetris-test/start.sh" >&2; exit 3; }
export ANTHROPIC_BASE_URL="${GW}" ANTHROPIC_AUTH_TOKEN="${KEY}" ANTHROPIC_MODEL="${MODEL}" \
ANTHROPIC_SMALL_FAST_MODEL="${MODEL}" ANTHROPIC_DEFAULT_OPUS_MODEL="${MODEL}" \
ANTHROPIC_DEFAULT_SONNET_MODEL="${MODEL}" ANTHROPIC_DEFAULT_HAIKU_MODEL="${MODEL}" \
CLAUDE_CODE_SUBAGENT_MODEL="${MODEL}"
exec claude --model "${MODEL}" "$@"