Billing API

The Billing API provides access to usage data, cost estimates, and budget configuration for your organization. Owner role is required for budget modifications. All endpoints require authentication.

Base URL

https://api.workjet.dev/v1

Endpoints

Get Usage Summary

GET /billing/usage

Returns token usage and cost summary for the current billing period.

Query Parameters

Parameter Type Description
from string (ISO date) Start date. Default: beginning of current billing period
to string (ISO date) End date. Default: now
groupBy string model, user, or day. Default: none (aggregate)

Response

{
  "period": {
    "from": "2026-04-01T00:00:00Z",
    "to": "2026-04-14T23:59:59Z"
  },
  "totals": {
    "requests": 1247,
    "inputTokens": 3456789,
    "outputTokens": 1234567,
    "estimatedCost": 42.15
  },
  "budgetCap": 200.00,
  "budgetRemaining": 157.85
}

Get Usage by Model

GET /billing/usage?groupBy=model

Response

{
  "groups": [
    {
      "model": "claude-4-sonnet",
      "requests": 834,
      "inputTokens": 2345678,
      "outputTokens": 876543,
      "estimatedCost": 31.20
    },
    {
      "model": "claude-3-haiku",
      "requests": 413,
      "inputTokens": 1111111,
      "outputTokens": 358024,
      "estimatedCost": 10.95
    }
  ]
}

Update Budget

PUT /billing/budget

Sets the monthly budget cap. Requires owner role.

Request Body

{
  "monthlyCap": 500.00
}

Next Steps