costroid

package module
v1.0.0-alpha.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Costroid

Costroid is the cost check for pull requests. An agent's own cost figure is an estimate, so Costroid prices the run's tokens from a pinned, dated catalog and posts the figure, with its basis, on the pull request. A recorded run on 2026-11-07:

This run cost USD 0.0391529 at list (Measured). Nothing held it to a budget.

Install

The recipes pin 1.0.0-alpha.14: install it.

Add it to the workflow you have

Already on claude-code-action, with an API key or a Claude subscription, or on openai/codex-action:

costroid init github --existing .github/workflows/claude.yml > costroid.patch
git apply costroid.patch

The patch adds a read step and a report job, shown here.

Try it on a pull request

--pr also sets the key and opens the pull request. Without it, init prints the rest:

costroid init github --agent claude
gh secret set ANTHROPIC_API_KEY
git switch -c try-costroid
git add .github/workflows/costroid.yml costroid.yml
git commit -m "Add the costroid check"
gh pr create --fill

The agent's job runs the third-party harden-runner to limit its egress.

First command

With Claude Code installed and signed in:

costroid run --budget-usd 5 --out rows.jsonl -- claude -p "Fix the failing test."
costroid report --preview --rows rows.jsonl

run prints, for a recorded subscription run:

costroid: claude-code, 4 requests
costroid: 19 rows in rows.jsonl, catalog 0.3.0
costroid: USD 0.001619725 at list, List-equivalent, not billed
costroid: budget USD 5, agent-flag: client-side estimate, can pass the cap
costroid: warning: BillingAccountId reads unknown: pass --billing-account or set COSTROID_BILLING_ACCOUNT

Each row is one request's token class, such as "SkuMeter":"input_uncached". report --preview prints the comment the rows would post.

More

In Claude Code, install the plugin:

/plugin marketplace add Costroid/costroid
/plugin install costroid@costroid

costroid connect binds an owner to Costroid Platform. export --format writes rows for another cost tool. The SDK recipes record Claude Agent SDK and Codex SDK programs. docs/ has the rest.

Licence

Apache-2.0. The CLI, the gate, the ledger schema, the plan schema, the FOCUS tag convention, the price catalog and the policy packs stay Apache-2.0 and are never relicensed. Contributions are under the Developer Certificate of Origin.

Documentation

Overview

Package costroid holds the published schema of costroid.yml.

Index

Constants

This section is empty.

Variables

View Source
var ConfigSchema []byte

ConfigSchema is the JSON Schema of costroid.yml.

View Source
var Recipes embed.FS

Recipes holds the CI recipes as this release ships them, under recipes/. A recipe's Costroid pin can name an earlier release, or none, because the commit that pins a release follows its tag. costroid init rewrites each pin to the release the binary belongs to.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
Package catalogdata embeds the price sheets of each release the binary carries.
Package catalogdata embeds the price sheets of each release the binary carries.
cmd
costroid command
Command costroid is the cost check for pull requests.
Command costroid is the cost check for pull requests.
internal
adapter
Package adapter holds what every agent adapter hands the wrapper.
Package adapter holds what every agent adapter hands the wrapper.
adapter/claudecode
Package claudecode reads Claude Code runs.
Package claudecode reads Claude Code runs.
adapter/codex
Package codex reads `codex exec --json` runs.
Package codex reads `codex exec --json` runs.
adapter/ghaw
Package ghaw reads what a GitHub Agentic Workflows (gh-aw) run spent, from the usage artifact its conclusion job uploads.
Package ghaw reads what a GitHub Agentic Workflows (gh-aw) run spent, from the usage artifact its conclusion job uploads.
agenttest
Package agenttest keeps a test from starting a real coding agent.
Package agenttest keeps a test from starting a real coding agent.
catalog
Package catalog prices token classes against the pinned sheets.
Package catalog prices token classes against the pinned sheets.
cicontext
Package cicontext reads what the CI system says about a run.
Package cicontext reads what the CI system says about a run.
comment
Package comment turns FOCUS rows into the check output and the sticky pull request comment.
Package comment turns FOCUS rows into the check output and the sticky pull request comment.
config
Package config checks a costroid.yml against the published schema.
Package config checks a costroid.yml against the published schema.
decimal
Package decimal is an exact base-10 number for money and quantities.
Package decimal is an exact base-10 number for money and quantities.
egress
Package egress is the one way out of costroid serve.
Package egress is the one way out of costroid serve.
export
Package export writes a rows file in the import format of another cost tool: FOCUS 1.4 CSV, a Vantage custom provider's CSV, or Datadog's Custom Costs CSV.
Package export writes a rows file in the import format of another cost tool: FOCUS 1.4 CSV, a Vantage custom provider's CSV, or Datadog's Custom Costs CSV.
fanout
Package fanout runs CPU-bound work over a list on every core the process has.
Package fanout runs CPU-bound work over a list on every core the process has.
focus
Package focus holds the Costroid FOCUS row, version 0.3, and its writer.
Package focus holds the Costroid FOCUS row, version 0.3, and its writer.
gateway
Package gateway gives one CI run its own key on a LiteLLM proxy.
Package gateway gives one CI run its own key on a LiteLLM proxy.
gateway/gatewaytest
Package gatewaytest serves the LiteLLM proxy routes costroid gateway calls, as LiteLLM v1.108.1 answered them on 2026-11-07, for tests.
Package gatewaytest serves the LiteLLM proxy routes costroid gateway calls, as LiteLLM v1.108.1 answered them on 2026-11-07, for tests.
history
Package history reads the result objects earlier reports posted on a pull request's commits, and adds their figures up with this run's.
Package history reads the result objects earlier reports posted on a pull request's commits, and adds their figures up with this run's.
mcpserver
Package mcpserver answers the Model Context Protocol over one connection, so an agent can ask what its run has cost while it works.
Package mcpserver answers the Model Context Protocol over one connection, so an agent can ask what its run has cost while it works.
oidc
Package oidc verifies CI OIDC ID tokens and reads a run's identity from them.
Package oidc verifies CI OIDC ID tokens and reads a run's identity from them.
oidc/oidctest
Package oidctest is a stub OIDC issuer for tests: an RSA key, a JWKS endpoint and a signer.
Package oidctest is a stub OIDC issuer for tests: an RSA key, a JWKS endpoint and a signer.
otlp
Package otlp reads OTLP/HTTP traces and logs into per-request usage.
Package otlp reads OTLP/HTTP traces and logs into per-request usage.
otlpemit
Package otlpemit sends a rows file to an OpenTelemetry backend as traces over OTLP/HTTP: one span per model request.
Package otlpemit sends a rows file to an OpenTelemetry backend as traces over OTLP/HTTP: one span per model request.
policy
Package policy decides the check's conclusion.
Package policy decides the check's conclusion.
recipelint
Package recipelint holds the shipped CI recipes to their security rules: no privileged trigger, every action pinned by SHA, and an agent's job that holds nothing but read access to the code.
Package recipelint holds the shipped CI recipes to their security rules: no privileged trigger, every action pinned by SHA, and an agent's job that holds nothing but read access to the code.
reconcile
Package reconcile compares the ledger with the provider's own reports, per credential per day.
Package reconcile compares the ledger with the provider's own reports, per credential per day.
review
Package review renders the agent's own answer as a second pull request comment, apart from Costroid's report.
Package review renders the agent's own answer as a second pull request comment, apart from Costroid's report.
run
Package run launches an agent under a budget and turns its usage into rows.
Package run launches an agent under a budget and turns its usage into rows.
scm
Package scm reaches a source-code host through one interface.
Package scm reaches a source-code host through one interface.
scm/scmtest
Package scmtest holds stub GitHub and GitLab APIs for tests.
Package scmtest holds stub GitHub and GitLab APIs for tests.
server
Package server is the ingest service behind costroid serve: the result-stream and OTLP paths, pricing against the pinned catalog, and the per-PR view.
Package server is the ingest service behind costroid serve: the result-stream and OTLP paths, pricing against the pinned catalog, and the per-PR view.
status
Package status writes a run's status file: what the run has spent so far, its cap, what is left and what holds it, for the agent and the job to read while the agent works.
Package status writes a run's status file: what the run has spent so far, its cap, what is left and what holds it, for the agent and the job to read while the agent works.
store
Package store is the ledger: FOCUS rows in Postgres, one tenant at a time.
Package store is the ledger: FOCUS rows in Postgres, one tenant at a time.
store/storetest
Package storetest runs Postgres in Docker for the packages that need it.
Package storetest runs Postgres in Docker for the packages that need it.
Package migrations embeds the forward-only schema migrations.
Package migrations embeds the forward-only schema migrations.
scripts
accuracy command
Command accuracy keeps the inputs of one day's reconciliation, writes the accuracy page from every day kept, and checks the page against them.
Command accuracy keeps the inputs of one day's reconciliation, writes the accuracy page from every day kept, and checks the page against them.
notice command
Command notice writes NOTICE from the modules a release build of costroid links and the licence and notice files each holds in the module cache.
Command notice writes NOTICE from the modules a release build of costroid links and the licence and notice files each holds in the module cache.
record command
Command record turns an agent's run into a test fixture that holds no content: no prompt, no reply, no tool output, no path and no credential.
Command record turns an agent's run into a test fixture that holds no content: no prompt, no reply, no tool output, no path and no credential.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL