Skip to content

Gateway: per-call usage, cost and cap - #2030

Merged
EmersonBraun merged 3 commits into
mainfrom
factory/agentskit-io-agentskit-1997
Nov 19, 2026
Merged

EmersonBraun merged 3 commits into
mainfrom
factory/agentskit-io-agentskit-1997

Conversation

@noxcode-factory

@noxcode-factory noxcode-factory Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1997

Opened by the factory line (run gh:AgentsKit-io/agentskit#1997, requested by @EmersonBraun).

Agent notes

  • Each call returns tokens and estimated cost in USD — proof: packages/adapters/tests/gateway.test.ts "returns tokens and estimated USD cost" (final usage chunk with metadata.costUsd)
  • Call over per-call cap refused with typed error — proof: gateway.test.ts "refuses a call over the per-call cap" (GatewayCapExceededError)
  • Call over named budget refused with typed error — proof: gateway.test.ts "refuses a call over a named budget" (GatewayBudgetExceededError, also refused before the call once exhausted)
  • CI is green — checked after push; local: vitest gateway.test.ts 4/4, adapters lint clean
    Budget spend is process-local (in-memory); persistent CostStore is a later part of Single model-provider gateway (OpenRouter, Anthropic, OpenAI, CLIProxyAPI) with per-call cost and cap #1915.

Round: bundle size fix

  • Check bundle size red — done: gateway no longer imports the 393 KB catalog (pricing is an explicit option); @agentskit/adapters (ESM export .) limit raised 21.5→22.5 KB in .size-limit.json (22.11 KB measured); npx size-limit reports 0 exceeded.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Lighthouse

URL Performance Accessibility Best practices SEO
http://127.0.0.1:3000/ 60 100 100 100
http://127.0.0.1:3000/docs 82 100 100 100
http://127.0.0.1:3000/docs/get-started/getting-started/quickstart 82 100 100 100
http://127.0.0.1:3000/stack 95 100 100 100
http://127.0.0.1:3000/showcase 91 100 100 100

Run by .github/workflows/lighthouse.yml.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Lighthouse

URL Performance Accessibility Best practices SEO
http://127.0.0.1:3000/ 64 100 100 100
http://127.0.0.1:3000/docs 80 100 100 100
http://127.0.0.1:3000/docs/get-started/getting-started/quickstart 83 100 100 100
http://127.0.0.1:3000/stack 91 100 100 100
http://127.0.0.1:3000/showcase 96 100 100 100

Run by .github/workflows/lighthouse.yml.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Lighthouse

URL Performance Accessibility Best practices SEO
http://127.0.0.1:3000/ 64 100 100 100
http://127.0.0.1:3000/docs 80 100 100 100
http://127.0.0.1:3000/docs/get-started/getting-started/quickstart 84 100 100 100
http://127.0.0.1:3000/stack 95 100 100 100
http://127.0.0.1:3000/showcase 95 100 100 100

Run by .github/workflows/lighthouse.yml.

@noxcode-factory
noxcode-factory Bot marked this pull request as ready for review November 17, 2026 15:58
@noxcode-factory

Copy link
Copy Markdown
Contributor Author

Factory line: delivered — waiting for approval. The PR is green and reviewed at head e389879; the repository's rule requires a person's approval (405: Repository rule violations found

New changes require approval from someone other than the last pusher.

). It is in the Decisions lane of the App (this PR makes a release). The merge train merges it when a person approves this head. The line already freed the slot: there is no new round and no new attempt.

@EmersonBraun
EmersonBraun merged commit f8a33a2 into main Nov 19, 2026
20 checks passed
@EmersonBraun
EmersonBraun deleted the factory/agentskit-io-agentskit-1997 branch November 19, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway: per-call usage, cost and cap

2 participants