Authentication
Requires a valid session token in the Authorization header:
Authorization: Bearer <session_token>
GET /api/spend/budgets
Retrieve all configured service budgets.
Response
Array of budget configurations
Service identifier (e.g., openai, anthropic, binance)
Daily spending limit in USD
Monthly spending limit in USD (null if not set)
Unix timestamp of last budget update
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 identifier to set budget for
Daily spending limit in USD
Monthly spending limit in USD (optional)
Response
Returns true if the budget was successfully saved
The saved budget configuration
Daily spending limit in USD
Monthly spending limit in USD (null if not set)
Unix timestamp of when the budget was saved
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
}
]
}