Skip to main content

Sync Billing

Force an immediate billing sync for all your API integrations. This updates balance and usage information from provider APIs.

Request

POST /api/v1/integrations/sync-billing

Headers

HeaderValueRequired
AuthorizationBearer {client_token}Yes

Query Parameters

ParameterTypeDescription
provider_namestringOptional: sync only this provider

Example Requests

Sync All Providers

curl -X POST "https://spideriq.ai/api/v1/integrations/sync-billing" \
-H "Authorization: Bearer $CLIENT_TOKEN"

Sync Specific Provider

curl -X POST "https://spideriq.ai/api/v1/integrations/sync-billing?provider_name=openrouter" \
-H "Authorization: Bearer $CLIENT_TOKEN"

Response

Success (200 OK)

{
"success": true,
"synced": 5,
"failed": 1,
"results": [
{
"id": 42,
"provider_name": "openrouter",
"status": "success",
"balance": 47.83,
"usage_today": 2.34,
"usage_month": 89.47,
"synced_at": "2026-02-26T15:45:00Z"
},
{
"id": 43,
"provider_name": "groq",
"status": "success",
"balance": null,
"usage_today": null,
"usage_month": null,
"synced_at": "2026-02-26T15:45:00Z",
"note": "Provider does not expose billing API"
},
{
"id": 44,
"provider_name": "mistral",
"status": "success",
"balance": 125.64,
"usage_today": 5.67,
"usage_month": 78.23,
"synced_at": "2026-02-26T15:45:00Z"
},
{
"id": 45,
"provider_name": "fal_ai",
"status": "failed",
"error": "API key invalid or expired",
"synced_at": "2026-02-26T15:45:00Z"
}
],
"total_balance": 173.47,
"total_usage_month": 167.70
}

Response Fields

FieldDescription
syncedNumber of integrations successfully synced
failedNumber of integrations that failed to sync
resultsPer-integration sync results
results[].balanceCurrent balance/credits (null if provider doesn't expose)
results[].usage_todayToday's spend in USD
results[].usage_monthThis month's spend in USD
results[].errorError message if sync failed
total_balanceSum of all balances
total_usage_monthSum of monthly usage

Provider Support

ProviderBalanceUsage TodayUsage MonthNotes
OpenRouterYesYesYesFull billing API
MistralYesYesYesFull billing API
CohereYesYesYesFull billing API
GroqNoNoNoFree tier, no billing API
CerebrasNoNoNoFree tier
fal.aiYesNoYesMonthly usage only
Google AIYesYesYesRequires billing project
TogetherYesYesYesFull billing API
OthersVariesVariesVariesContact support

Notes

  • Automatic sync runs every 4 hours
  • Manual sync is rate-limited to 1 request per minute
  • Failed syncs update billing_sync_error on the integration
  • Successful syncs clear any previous sync errors
  • Spend snapshots are saved for historical tracking