Routines billed to metered API credits instead of the Max subscription, while subscription headroom remained
Summary
Scheduled Routines created and owned under a Max 20x subscription ($200/mo) were billed entirely to
pay-as-you-go API credits rather than drawing down subscription usage, while substantial
subscription headroom remained (interactive usage never approached plan limits in this period).
Over two months this amounted to $1,122.83 in metered API charges: $821.39 (June 2026) and
$301.44 (July 1–17, 2026), drawn via repeated ~$45 auto-reload credit grants.
The apparent cause is an ANTHROPIC_API_KEY present in the cloud environment attached to the
routine. Nothing in the Routines UI, the run history, or the Routines documentation indicates that an
environment variable can silently redirect a routine's billing off the subscription and onto metered
API credits.
Expected behavior
Per Routines → Usage and limits:
"Routines draw down subscription usage the same way interactive sessions do."
The same page documents metered billing only as an overage path, conditional on first exhausting the
plan:
"When a routine hits the daily cap or your subscription usage limit, organizations with usage
credits turned on can keep running routines on metered overage."
With subscription headroom remaining, neither condition was met, so runs should have drawn down
subscription usage.
Actual behavior
Every routine run was billed as metered API usage from the first run onward — not after any cap was
reached. The Console Cost dashboard shows continuous near-daily spend tracking the routine's
schedule (every 3 hours, ~8 runs/day), across Opus and Sonnet, including ~6,290 web searches in June
alone. Subscription usage was not exhausted at any point.
Environment
- Plan: Max 20x (claude.ai subscription)
- Routine created from the Claude Code macOS Desktop app (Cloud routine), schedule trigger every 3 hours
- Cloud environment: custom environment with environment variables set for the repository's own tooling
- Among those variables:
ANTHROPIC_API_KEY (present for unrelated reasons — a fenced build-time
script and Cloudflare Worker secrets; not needed by the routine's own work)
Suspected mechanism
Two separate layers appear to be involved, and only the first is documented:
- Routine creation/ownership requires a claude.ai login. This is documented, and
/schedule is
correctly unavailable when an API key is the active local credential.
- The cloud session that executes the run inherits the cloud environment's variables. Per
Authentication, ANTHROPIC_API_KEY sits above
subscription OAuth in Claude Code's credential precedence. So a key injected as a cloud environment
variable appears to be picked up by the Claude Code process inside the run and to take precedence
over the subscription that owns the routine.
If that is what is happening, the routine is owned by a subscription but executed against API billing,
with no surface anywhere that reflects the split.
Why this is hard to notice
- The Routines documentation discusses environment variables only as a capability and
secrets-exposure concern, never as something that can change billing.
- The routine's run history shows successful runs with no indication of billing source.
- claude.ai subscription usage and Console API spend are separate dashboards; nothing correlates a
routine run to the API charge it produced.
- Console spend-threshold alerts do fire, but they report only that a dollar threshold was crossed —
not which product consumed it, and not that a subscription-owned routine was the consumer. In this
case they arrived well after the majority of the spend.
- Auto-reload silently funds the resulting consumption in ~$45 increments.
Suggested fixes (any one would have prevented this)
- Ignore
ANTHROPIC_API_KEY from cloud environment variables for routine execution, or require
an explicit opt-in, since routines are inherently subscription-owned.
- Warn at routine creation/edit time when the selected cloud environment defines
ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN, stating plainly that runs will bill metered API
credits rather than the subscription.
- Show the billing source on the routine detail page and on each run ("this run drew down
subscription usage" vs "this run billed API credits").
- Document the precedence interaction in Routines → Usage and limits — currently the only
metered path described is overage after plan exhaustion.
Impact
$1,122.83 over two months on an account already paying $200/month for the plan the work was intended
to run on, with no in-product signal that the two had become decoupled.
Routines billed to metered API credits instead of the Max subscription, while subscription headroom remained
Summary
Scheduled Routines created and owned under a Max 20x subscription ($200/mo) were billed entirely to
pay-as-you-go API credits rather than drawing down subscription usage, while substantial
subscription headroom remained (interactive usage never approached plan limits in this period).
Over two months this amounted to $1,122.83 in metered API charges: $821.39 (June 2026) and
$301.44 (July 1–17, 2026), drawn via repeated ~$45 auto-reload credit grants.
The apparent cause is an
ANTHROPIC_API_KEYpresent in the cloud environment attached to theroutine. Nothing in the Routines UI, the run history, or the Routines documentation indicates that an
environment variable can silently redirect a routine's billing off the subscription and onto metered
API credits.
Expected behavior
Per Routines → Usage and limits:
The same page documents metered billing only as an overage path, conditional on first exhausting the
plan:
With subscription headroom remaining, neither condition was met, so runs should have drawn down
subscription usage.
Actual behavior
Every routine run was billed as metered API usage from the first run onward — not after any cap was
reached. The Console Cost dashboard shows continuous near-daily spend tracking the routine's
schedule (every 3 hours, ~8 runs/day), across Opus and Sonnet, including ~6,290 web searches in June
alone. Subscription usage was not exhausted at any point.
Environment
ANTHROPIC_API_KEY(present for unrelated reasons — a fenced build-timescript and Cloudflare Worker secrets; not needed by the routine's own work)
Suspected mechanism
Two separate layers appear to be involved, and only the first is documented:
/scheduleiscorrectly unavailable when an API key is the active local credential.
Authentication,
ANTHROPIC_API_KEYsits abovesubscription OAuth in Claude Code's credential precedence. So a key injected as a cloud environment
variable appears to be picked up by the Claude Code process inside the run and to take precedence
over the subscription that owns the routine.
If that is what is happening, the routine is owned by a subscription but executed against API billing,
with no surface anywhere that reflects the split.
Why this is hard to notice
secrets-exposure concern, never as something that can change billing.
routine run to the API charge it produced.
not which product consumed it, and not that a subscription-owned routine was the consumer. In this
case they arrived well after the majority of the spend.
Suggested fixes (any one would have prevented this)
ANTHROPIC_API_KEYfrom cloud environment variables for routine execution, or requirean explicit opt-in, since routines are inherently subscription-owned.
ANTHROPIC_API_KEY/ANTHROPIC_AUTH_TOKEN, stating plainly that runs will bill metered APIcredits rather than the subscription.
subscription usage" vs "this run billed API credits").
metered path described is overage after plan exhaustion.
Impact
$1,122.83 over two months on an account already paying $200/month for the plan the work was intended
to run on, with no in-product signal that the two had become decoupled.