Skip to main content

Authentication

Requires a valid session token in the Authorization header:
Authorization: Bearer <session_token>

GET /api/spend/budgets

Retrieve all configured service budgets.

Response

budgets
array
Array of budget configurations

PUT /api/spend/budgets

Set or update budget for a specific service. Creates a new budget if one doesn’t exist for the service.

Request Body

service
string
required
Service identifier to set budget for
daily_budget_usd
number
required
Daily spending limit in USD
monthly_budget_usd
number
Monthly spending limit in USD (optional)

Response

success
boolean
Returns true if the budget was successfully saved
budget
object
The saved budget configuration

Error Responses

  • 401 Unauthorized: Missing or invalid session token
  • 500 Internal Server Error: Database error
curl -X GET https://localhost:3100/api/spend/budgets \
  -H 'Authorization: Bearer fn_sess_abc123def456'
{
  "budgets": [
    {
      "service": "openai",
      "daily_budget_usd": 100.0,
      "monthly_budget_usd": 2500.0,
      "updated_at": 1709500000
    },
    {
      "service": "anthropic",
      "daily_budget_usd": 50.0,
      "monthly_budget_usd": null,
      "updated_at": 1709499500
    },
    {
      "service": "binance",
      "daily_budget_usd": 500.0,
      "monthly_budget_usd": 10000.0,
      "updated_at": 1709498000
    }
  ]
}

Build docs developers (and LLMs) love