post
https://api.agent700.ai/api/billing/external-usage
Records token usage from an external service (e.g., voice transcription) into the agent700 billing pipeline. The usage is persisted to the database and reported to Stripe metered billing — identical to the standard agent chat billing flow.
Authorization
Requires a valid Bearer token (JWT or App Password) for a user who holds the
superadmin role in at least one active organization membership.
Authorization: Bearer <your_access_token>
This endpoint is intended for internal/service-to-service use only. The caller
must be assigned the `superadmin` role via the organization roles system before
calling this endpoint.
Billing Pipeline
- Validates the
service_nameagainst theservicestable. - Validates the
model_nameagainst thetext_model_costspricing table. - Calculates
serviceCostandagent700Costfrom token counts and per-token rates. - Writes a row to
user_billable_request_logs(linked to the service, not an agent). - Reports
agent700Costto Stripe metered billing for the specified organization.
