git-subtree-dir: vendor/trainer git-subtree-mainline:c7c2956e15git-subtree-split:a2a9f4edcf
23 lines
979 B
Bash
Executable File
23 lines
979 B
Bash
Executable File
#!/bin/sh
|
|
# LLM backend for portal-trainer on Claude Code's own login (a Max or
|
|
# Pro subscription): prompt on stdin, text on stdout. No API key
|
|
# needed: an ANTHROPIC_API_KEY in the environment would outrank the
|
|
# login, so it is dropped here. Log the CLI in once with
|
|
# `claude auth login`; `claude auth status` shows what it uses.
|
|
# MODEL is an alias or id (sonnet, opus, claude-sonnet-5); EFFORT is
|
|
# low, medium or high. Not --bare: that mode skips the stored login.
|
|
#
|
|
# The generator's SEED and TEMPERATURE hints cannot be honoured;
|
|
# FORMAT=json is turned into an instruction.
|
|
set -eu
|
|
unset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN CLAUDECODE CLAUDE_CODE_ENTRYPOINT
|
|
prompt=$(cat)
|
|
if [ "${FORMAT:-}" = json ]; then
|
|
prompt="$prompt
|
|
|
|
Reply with the JSON object only, no prose, no code fences."
|
|
fi
|
|
printf '%s' "$prompt" | claude -p --model "${MODEL:-sonnet}" --effort "${EFFORT:-low}" \
|
|
--output-format text --permission-mode dontAsk --no-session-persistence \
|
|
--tools ""
|