Billing Overview
Understand CodeCourier billing model, account types, billing cycles, payment methods, and cost management.
CodeCourier operates on a usage-based billing model where costs are driven by the external services consumed during AI agent operations. Rather than charging a flat subscription fee, CodeCourier tracks your actual consumption of sandbox compute time, AI model tokens, and background job processing, then calculates costs based on published rates. This page provides an overview of how billing works, account types, and how to manage your costs effectively.
Billing Model
CodeCourier's billing revolves around the concept of usage-based cost tracking. Every operation that consumes external resources is recorded with its associated cost. The tracked services include:
- Claude Code-- Token usage from Anthropic's Claude models (input tokens, output tokens), tracked per model tier.
- E2B -- Sandbox compute time measured in seconds of active VM uptime.
- Trigger.dev -- Background job execution time and compute resources.
- Convex -- Database operations and bandwidth consumption.
- OpenCode -- Token usage from alternative AI coding tools.
- Codex -- Token usage from OpenAI Codex-based tools.
Each service has configurable cost rates stored in the usageCostRates table. Rates can be defined per metric type (input tokens, output tokens, sandbox hours, storage) and per model or tier (for example, Claude Opus versus Claude Sonnet have different per-token costs).
How Costs Are Calculated
When a Trigger.dev task completes a step (designer iteration, checker review, issue session, etc.), it reports usage metrics back to Convex through the usage.computeCostAndRecord callback operation. This operation:
- Looks up the applicable cost rate for the service and metric type.
- Multiplies the quantity consumed by the cost per unit.
- Creates a
usageRecordentry with the calculated cost in USD, linked to the project, run, and sandbox that generated it.
This approach provides detailed attribution: you can see exactly which run, which step, and which model generated each cost, down to the individual token count.
Account Types
Individual Accounts
Every CodeCourier user starts with an individual account. You can create projects, configure provider API keys, launch sandboxes, and run workflows. All usage is tracked at the project level.
Team Accounts
Projects can have multiple members with different roles (owner, admin, member). Usage is aggregated at the project level regardless of which team member initiated the operation. This means the project owner sees a unified view of all usage across the team.
Billing Cycle
Usage is tracked continuously and aggregated on a daily basis. The usageRecords table stores records with an ISO date string (YYYY-MM-DD format), enabling queries by date range. The dailyStats table provides pre-aggregated daily statistics for quick dashboard rendering.
You can view your usage for any time period through the usage dashboard, which supports the following views:
- Daily breakdown -- Cost per day over a selected date range.
- Service breakdown -- Cost by service (Claude Code, E2B, Trigger.dev, etc.).
- Model breakdown -- Cost by specific model (useful for optimizing model selection).
- Run attribution -- Cost per individual run, including per-step breakdown.
Payment Methods
CodeCourier uses a bring-your-own-key model for external services. Rather than charging you through a central billing system, you provide your own API keys for each service:
- E2B -- You sign up directly with E2B and provide your API key. E2B bills you directly for sandbox compute time.
- Anthropic -- You use your own Anthropic API key or OAuth token. Anthropic bills you directly for token usage.
- OpenRouter / OpenAI -- Same model: you provide your own key and are billed by the provider.
CodeCourier's cost tracking is an informational feature that helps you understand and optimize your spending across these services. The costs displayed in the dashboard are calculated based on published rates and may differ slightly from your actual provider invoices due to rate changes or volume discounts.
Cost Management
Setting Budgets
While CodeCourier does not enforce hard spending limits (since you are billed by external providers), the usage tracking system helps you stay informed. Monitor your daily and weekly spending through the analytics dashboard and set up your own alerts through your provider dashboards.
Optimizing Costs
Several strategies can help reduce costs:
- Choose appropriate models. Use smaller, faster models for simple tasks and reserve larger models for complex work. The persona system lets you assign specific models to different workflow steps.
- Set reasonable iteration limits. Designer- checker workflows with unlimited iterations can consume significant tokens. Set a
maxIterationslimit that balances quality with cost. - Use sandbox timeouts. Configure appropriate timeouts to prevent sandboxes from running longer than needed.
- Kill idle sandboxes.Use the "Kill All Sandboxes" action when you are done working to stop unnecessary E2B charges.
- Review run analytics. The per-run cost breakdown helps identify expensive runs and optimize workflows accordingly.
Enterprise Tracking
CodeCourier's usage records include enterprise-grade tracking fields for organizations that need detailed cost attribution:
toolId-- Which CLI tool was used (claude, opencode, codex).modelId-- The exact model ID used.stepType-- Which pipeline step generated the usage.stepIndex-- The iteration number.inputTokens/outputTokens-- Raw token counts for precise cost verification.durationMs-- Step execution duration.userId-- Which team member triggered the operation.personaId-- Which persona was responsible.
These fields enable detailed reporting and cost allocation across teams, projects, and workflows.