Skip to main content
The Syon usage and billing APIs let you retrieve token usage and charges for individual model requests, aggregate usage and billing over a time range, and check the current account balance. This document describes the API contract. Actual production responses take precedence.

API overview

Getting started

Base URL

Use the API Base URL shown in the Syon console. The examples below refer to it as $TEAMO_BASE_URL: bash

Authentication

Send your Syon API key in the Authorization header of every request: http
Keep your API key secure. Do not include it in frontend code, public repositories, or logs. All keys and IDs in the examples are fictional.

Retrieve usage and billing for a single request

Use a request ID to retrieve the token usage and final charge for one model call. http

Path parameters

Request example

bash

Response example

json

Token fields

Token categories that do not apply or are not provided by the upstream service return 0.

Retrieve billing for a time range

Retrieve billing totals for the authenticated API key over a time range. The basic response contains aggregate data only, not individual request records. http

Query parameters

The query range must not exceed 90 days. Longer ranges return 400 invalid_request.

Request example

bash

Response example

json

Retrieve token usage for a time range

Retrieve aggregate token usage for the authenticated API key over a time range. http

Query parameters

The query range must not exceed 90 days. Longer ranges return 400 invalid_request.

Request example

bash

Response example

json

Retrieve the account balance

Retrieve the available balance for the account associated with the current API key. http
This endpoint does not accept query parameters. The API key identifies the account.

Request example

bash

Response example

json

Error handling

When an API call fails, the response body contains a stable error code and a message that helps diagnose the problem. json

Common error codes

Recommendations

  • Use the same start_time and end_time when reconciling usage and billing so both queries use the same scope.
  • Prices may change. Use the amount returned with historical billing records instead of recalculating past charges from the current price list.
  • Configure reasonable timeouts and retries. Use exponential backoff for 429 and 5xx responses.