Skip to content
Diese Seite ist noch nicht in Ihrer Sprache verfügbar und wird deshalb auf Englisch angezeigt.

Request Logs and Account Pricing

Look up the charge for a single call by request ID or task ID - Page through every consume and error record by time range - Get the price your account actually pays for a model

Gesamte Dokumentation

Use your API Key to look up the charge for each call, and the actual price your account pays for a model. None of the three endpoints check the balance; they work even when the balance is 0.

Single record
curl 'https://api.apisea.ai/v1/logs/requests/task_01M6ZDAXTC8QXYCDM5PXPM413R' \
  --header 'Authorization: Bearer <token>'
Sync logs
curl --get 'https://api.apisea.ai/v1/logs/requests' \
  --header 'Authorization: Bearer <token>' \
  --data-urlencode 'start_timestamp=1762732800' \
  --data-urlencode 'end_timestamp=1762736400' \
  --data-urlencode 'limit=1000'
Account pricing
curl --get 'https://api.apisea.ai/v1/pricing/model' \
  --header 'Authorization: Bearer <token>' \
  --data-urlencode 'model=doubao-seedance-2.0' \
  --data-urlencode 'resolution=720P' \
  --data-urlencode 'duration=5'
Single record
{
  "object": "list",
  "request_id": "task_01M6ZDAXTC8QXYCDM5PXPM413R",
  "data": [
    {
      "id": "task_01M6ZDAXTC8QXYCDM5PXPM413R",
      "type": "consume",
      "status": "succeeded",
      "created_at": 1762740123,
      "model_name": "doubao-seedance-2.0",
      "token_name": "prod-server",
      "task_id": "task_01M6ZDAXTC8QXYCDM5PXPM413R",
      "prompt_tokens": 0,
      "completion_tokens": 0,
      "cache_tokens": 0,
      "cache_creation_tokens": 0,
      "cost_usd": 0.6,
      "cost_credits": 6
    }
  ]
}
Sync logs
{
  "object": "list",
  "data": [
    {
      "id": "<request ID>",
      "type": "consume",
      "status": "succeeded",
      "created_at": 1762732805,
      "model_name": "gpt-5.5",
      "token_name": "prod-server",
      "prompt_tokens": 1200,
      "completion_tokens": 350,
      "cache_tokens": 0,
      "cache_creation_tokens": 0,
      "latency_ms": 2310,
      "first_token_ms": 420,
      "cost_usd": 0.004125,
      "cost_credits": 0.04125
    }
  ],
  "has_more": true,
  "next_cursor": "AQAAAABpEoXlAjIwMjYxMTEw...",
  "watermark": 1762739700
}
Account pricing
{
  "model": "doubao-seedance-2.0",
  "canonical_model": "doubao-seedance-2.0",
  "currency": "USD",
  "group": "vip",
  "billing_type": "per_second",
  "unit": "per_second",
  "spec": { "resolution": "720P", "duration": 5 },
  "spec_source": "request",
  "estimated": false,
  "unit_price_usd": 0.12,
  "quantity": 5,
  "total_usd": 0.6,
  "credits": { "unit_price": 1.2, "total": 6 },
  "price_source": "membership",
  "price_factors": ["membership"],
  "membership_tier": "gold"
}

Authentication

Authorizationstringrequired

Use the same API Key you use to call models, with Bearer Token authentication. Get your key on the API Key management page.

text
Authorization: Bearer YOUR_API_KEY

Endpoints

text
GET /v1/logs/requests/{id}    Look up a single record by request ID
GET /v1/logs/requests         Sync logs by time range
GET /v1/pricing/model         Get account pricing

Amounts are in USD; cost_credits and credits are in credits, equal to USD × 10.


Look up a single record by request ID

text
GET /v1/logs/requests/{id}
idstringrequired
  • Synchronous calls: the value of the X-APISea-Request-Id response header
  • Asynchronous tasks: the task ID returned on submission

Note

Logs are written asynchronously and usually appear within a few seconds after the request ends. If you get 404 log_not_found, retry later. Asynchronous tasks must be looked up by task ID, and only have a record once the task has completed or failed.

The lookup covers the whole account that owns the API Key. data is an array; the same ID may have both a consume record and an error record. Main fields:

FieldDescription
idRequest ID or task ID
typeconsume or error
created_atRecord time, Unix seconds; for asynchronous tasks, the settlement time
model_nameModel name
token_nameName of the API Key that made the call (the name when the record was written; names may repeat). To tell keys apart precisely, filter by token_id in the sync endpoint
prompt_tokens / completion_tokensInput / output tokens
cost_usdAmount charged for this record (USD)
cost_creditsCredits charged

cost_usd is the final settled amount: error records are always 0, and refunds for failures are completed before the record is written. Summing records whose type is consume gives the total charged for your calls.


Sync Request Logs

text
GET /v1/logs/requests

Page through every record in your account over a time range — ideal for scheduled reconciliation. Each record has the same fields as the single-record lookup.

start_timestampintegerrequired

Start time, Unix timestamp in seconds.

end_timestampinteger

End time, Unix timestamp in seconds. Defaults to now. Both ends are inclusive, and the range must not exceed 31 days.

typestringdefault: all

Record type: all, consume, or error.

modelstring

Filter by model name.

token_idinteger

Only return records of the given API Key. Copy the ID from the "API Keys" list in the console (shown below the key name); the ID stays the same after the key is rotated.

limitintegerdefault: 100

Page size, 1–1000.

cursorstring

Pagination cursor. Pass back the previous page's next_cursor unchanged, and keep all other parameters the same while paging.

In the response, has_more tells you whether there is another page, next_cursor is the cursor for the next page, and watermark is the server time minus 300 seconds.

Tip

Recommended sync pattern: keep each run's end_timestamp no later than watermark; start the next run 10 minutes before the previous run's end and dedupe by (id, type); within one time window, keep paging until has_more is false.


Get account pricing

text
GET /v1/pricing/model

Get the actual price the account that owns the current API Key pays for a model. Custom pricing, membership pricing, group ratio, and discounts are all applied, matching what you are charged when calling. The pricing page shows public prices; use this endpoint to estimate costs for your own account.

modelstringrequired

Model name; aliases are supported.

resolutionstring

Resolution or tier; must be a tier the model supports.

sizestring

Image size.

qualitystring

Quality tier.

durationinteger

Duration in seconds, 1–3600, for per-second models.

ninteger

Number of outputs, 1–100.

Without spec parameters, the model's default spec is quoted. For per-second models, only the per-second price is returned when duration is omitted.

Main response fields:

FieldDescription
unitPrice unit: per_image, per_call, per_second, per_million_tokens
unit_price_usdUnit price (USD)
total_usdTotal price for this spec (USD)
unit_pricesReturned for token-billed models: price per million tokens, e.g. input, output
estimatedtrue means the final charge depends on actual usage (e.g. token billing); the quote is for reference only
price_sourcePrice source: membership (membership price), user_override (custom price), group (group price), default (standard price)

Up to 60 requests per minute per API Key.


Errors

HTTP statuserror.codeDescription
400invalid_request_id / invalid_request, etc.Invalid parameter; see message for details
400time_range_too_largeLog time range exceeds 31 days
401 / 402 / 403—API Key invalid, expired, or disabled
404log_not_foundLog record not found; it may not have been written yet
404model_not_found / no_valid_pricingModel does not exist or has no pricing
429—Too many requests
500 / 503—Service temporarily unavailable, please retry later

Einen Fehler in dieser Dokumentation gefunden? Schreiben Sie an support@apisea.ai.