API keys and caps
Optional, paid, and capped by you.
The Pipe runs each job on your Claude or ChatGPT plan. Separately, the huntaway ask command can
send one question to Anthropic's or OpenAI's paid API, with your own API key. This is the only part of Huntaway
that is billed by the API rather than covered by your plan, so it won't run until you set two dollar caps.
On your plan (the Pipe)
huntaway ask --engine pipe runs the question through the
Pipe on your Claude or ChatGPT plan. No API key and no API bill.
On your API key
huntaway ask with the Anthropic engine (the default) or
--engine openai. Billed by that provider to your API account, and checked against your caps first.
Set it up
$ huntaway key set anthropic # macOS: enter your key with echo off # On Linux, set ANTHROPIC_API_KEY in your environment. $ export HUNTAWAY_MAX_USD_PER_QUESTION=1 $ export HUNTAWAY_MAX_USD_PER_DAY=10 $ huntaway doctor $ huntaway ask "What is the capital of Australia?"
For OpenAI, use huntaway key set openai (or OPENAI_API_KEY) and
--engine openai.
The caps
- Both caps are required: a dollar amount per question and per day, from $0.01 to $1,000. The day cap must be at least the question cap. With no caps set, a paid engine won't run.
- It checks a worst case before it sends anything billed. It works out a hard worst case from its own price table and your output limit, and refuses any call whose worst-case cost would go over a cap. A refusal names the cap the question needs.
- One call can still go over. If the price table is wrong, or the provider ignores the pricing tier Huntaway asks for, a single call can cost more than the cap. Huntaway then warns you and blocks that model from further calls.
- The day is the last 24 hours, rolling, not midnight to midnight.
- The caps cover Huntaway's own use on this computer, under its data folder
(
HUNTAWAY_HOME), not your whole provider account. - The caps guard against accidents, not against you. You can raise them whenever you like.
What you see before every paid call
Each paid question prints two lines. The first comes before anything is sent, even the free count:
This question uses your paid Anthropic API key; any charge goes to that account. Huntaway first asks Anthropic to count the question (free), which sends it to Anthropic. Caps: $1.00 a question, $10.00 a day (Huntaway's own use on this machine).
The second comes after the count, before the billed call: the worst case, an estimate, and what you've used in the last 24 hours. This is the README's own example, for a 10,240-byte request:
At most $0.06 for this question (about $0.0175 by Anthropic's count); $0.02 of your $10.00 used in the last 24 hours.
"At most" is the worst case from Huntaway's price table, rounded up to the cent. "About" is only an estimate. Neither is a promise about what you'll be billed: your provider bills you directly.
Your key
- Where it comes from: an environment variable (
ANTHROPIC_API_KEYorOPENAI_API_KEY), or on macOS your keychain, whichhuntaway key setwrites to. On Linux, use the environment. - Where it goes: only to the provider you chose.
- Where it never goes: Huntaway never writes your key to a file, and never puts it in a log, a
run record, the spend ledger, an error or a command's arguments.
huntaway doctorreports where the key came from, never its value. - Worth knowing: any program running as you can read a keychain item or an environment variable. Keep your computer's other software in mind.
huntaway key remove anthropic(oropenai) removes the stored key.
What each paid call sends
Two calls per question: a free token count, then the answer. Both go to the provider you chose, which keeps its own records under its own terms. Neither call is retried, so a question can't be billed twice without you knowing.
Next: what each result means, or your data.