Models and costs
Choose models
Section titled “Choose models”Models are chosen in .github/codehawk.json on the default branch. The inference document is deprecated for one release and overrides file routes while set. Each profile names a connection and a model ID: a direct OpenAI, Anthropic, or Google connection, an approved OpenAI-compatible endpoint, or an optional Cloudflare AI Gateway route. Use model IDs available to your account. Add per-role routes under jobs, with ordered fallbacks where needed. Legacy inference documents use roles instead.
Direct connections send only their own authentication and no Cloudflare headers. Cloudflare connections send usage metadata and disable Gateway payload logging. Prompts and response payloads are not logged by Code Hawk. Review each provider's own data policy for any source you send to it.
Token accounting
Section titled “Token accounting”Each run has one spend tracker. Before a call, it reserves the most the call could cost: the estimated prompt (one token per three characters) plus the largest answer allowed, at the trusted profile's price or the model's rate in packages/action/src/prices.ts. A capped run refuses a reservation when tracked spend and outstanding reservations would exceed its budget.
Unknown models use a ceiling of $10 input and $50 output per million tokens. Compatible endpoints always use that ceiling unless their trusted profile declares a positive price, even when the model name matches the built-in table. Only trusted profile prices can override these rates.
Retries, JSON repair, fallback profiles, and concurrent roles share one ledger. Uncertain transport failures and unreadable successful responses settle at the full reservation before another attempt. A valid answer with missing or invalid usage settles at the ceiling, marked estimated, rather than counting as free. HTTP failures release their hold. Summaries show model totals plus profile and connection totals, so fallback spend is visible. The tracker estimates local spend. Check provider billing for actual charges.
Spend limits by job
Section titled “Spend limits by job”Every model job is uncapped unless a cap is set. The automatic setup pull request starts with a 1 USD cap per review and a 0.10 USD cap per reply. Set a cap in the setup page, through a settings command, or by editing caps in .github/codehawk.json. Use null in the file to remove a cap. The configuration table lists the cap keys and their deprecated inputs.
Precedence is the nonempty deprecated caller input, then caps.<job>, then its deprecated section key on the default branch, then uncapped. Caller inputs accept a positive number or uncapped. Empty inputs do not override the file. pr_review.max_usd, pr_review.reply_max_usd, weekly.max_usd, fix_issues.max_usd and fix_issues.max_usd_per_issue still work for one release and warn. Move them to caps.
- PR review uses at most 12,000 input and 6,000 output tokens per chunk. A cap stops remaining chunks and preserves the previous fully reviewed checkpoint. The summary shares its ledger.
- Replies have their own
pr_replycap and the existing per-PR reply count limit. - Weekly review uses two find passes and independent confirmation. Findings left unchecked by a cap are never filed.
- Labelled and requested fixes use the
fix_issuesrun cap andfix_issues_per_issueinner cap on one shared ledger. Both may be uncapped. - Browser planning, driving and diagnosis share
caps.flows, including fallbacks.--max-usdremains a deprecated override. - Static PR scan makes no model calls.
Every model job writes Model spend $X.XXXX (uncapped) or Model spend $X.XXXX of the $N cap to its log and step summary. Setup failures report zero spend. Provider checks have no model spend. Request limits, timeouts, output limits, finding limits and isolation still apply to uncapped runs.