> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apimart.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 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 

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.

```bash Single record theme={null}
curl 'https://api.apimart.ai/v1/logs/requests/task_01M6ZDAXTC8QXYCDM5PXPM413R' \
  --header 'Authorization: Bearer <token>'
```

```bash Sync logs theme={null}
curl --get 'https://api.apimart.ai/v1/logs/requests' \
  --header 'Authorization: Bearer <token>' \
  --data-urlencode 'start_timestamp=1762732800' \
  --data-urlencode 'end_timestamp=1762736400' \
  --data-urlencode 'limit=1000'
```

```bash Account pricing theme={null}
curl --get 'https://api.apimart.ai/v1/pricing/model' \
  --header 'Authorization: Bearer <token>' \
  --data-urlencode 'model=doubao-seedance-2.0' \
  --data-urlencode 'resolution=720P' \
  --data-urlencode 'duration=5'
```

```json Single record theme={null}
{
  "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
    }
  ]
}
```

```json Sync logs theme={null}
{
  "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
}
```

```json Account pricing theme={null}
{
  "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

**Authorization** `string` *required*

Use the same API Key you use to call models, with Bearer Token authentication. Get your key on the [API Key management page](https://apimart.ai/keys).

```
Authorization: Bearer YOUR_API_KEY
```

## Endpoints

```text theme={null}
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 theme={null}
GET /v1/logs/requests/{id}
```

**id** `string` *required*

* Synchronous calls: the value of the `X-Oneapi-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:

| Field | Description |
| - | - |
| `id` | Request ID or task ID |
| `type` | `consume` or `error` |
| `created_at` | Record time, Unix seconds; for asynchronous tasks, the settlement time |
| `model_name` | Model name |
| `token_name` | Name 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_tokens` | Input / output tokens |
| `cost_usd` | Amount charged for this record (USD) |
| `cost_credits` | Credits 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 theme={null}
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\_timestamp** `integer` *required*

Start time, Unix timestamp in seconds.

**end\_timestamp** `integer`

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

**type** `string` (default: all)

Record type: `all`, `consume`, or `error`.

**model** `string`

Filter by model name.

**token\_id** `integer`

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.

**limit** `integer` (default: 100)

Page size, `1`–`1000`.

**cursor** `string`

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 theme={null}
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.

**model** `string` *required*

Model name; aliases are supported.

**resolution** `string`

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

**size** `string`

Image size.

**quality** `string`

Quality tier.

**duration** `integer`

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

**n** `integer`

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:

| Field | Description |
| - | - |
| `unit` | Price unit: `per_image`, `per_call`, `per_second`, `per_million_tokens` |
| `unit_price_usd` | Unit price (USD) |
| `total_usd` | Total price for this spec (USD) |
| `unit_prices` | Returned for token-billed models: price per million tokens, e.g. `input`, `output` |
| `estimated` | `true` means the final charge depends on actual usage (e.g. token billing); the quote is for reference only |
| `price_source` | Price 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 status | `error.code` | Description |
| - | - | - |
| 400 | `invalid_request_id` / `invalid_request`, etc. | Invalid parameter; see `message` for details |
| 400 | `time_range_too_large` | Log time range exceeds 31 days |
| 401 / 402 / 403 | — | API Key invalid, expired, or disabled |
| 404 | `log_not_found` | Log record not found; it may not have been written yet |
| 404 | `model_not_found` / `no_valid_pricing` | Model does not exist or has no pricing |
| 429 | — | Too many requests |
| 500 / 503 | — | Service temporarily unavailable, please retry later |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.