> ## 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.

# 요청 로그 및 계정 적용 가격

>  - 요청 ID 또는 작업 ID로 단일 호출의 과금액 조회 - 시간 범위로 모든 소비 및 실패 내역을 페이지 단위로 동기화 - 현재 계정에 실제로 적용되는 모델 가격 조회 

API Key를 사용해 각 호출의 과금 내역과, 현재 계정이 모델을 호출할 때의 실제 가격을 조회합니다. 세 엔드포인트 모두 잔액을 확인하지 않으므로 잔액이 0이어도 호출할 수 있습니다.

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

```bash 로그 동기화 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 적용 가격 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 단건 조회 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 로그 동기화 theme={null}
{
  "object": "list",
  "data": [
    {
      "id": "<요청 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 적용 가격 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"
}
```

## 인증

**Authorization** `string` *required*

모델 호출과 동일한 API Key를 사용하여 Bearer Token으로 인증합니다. [API Key 관리 페이지](https://apimart.ai/keys)에서 키를 발급받으세요.

```
Authorization: Bearer YOUR_API_KEY
```

## 엔드포인트

```text theme={null}
GET /v1/logs/requests/{id}    요청 ID로 단건 조회
GET /v1/logs/requests         시간 범위로 로그 동기화
GET /v1/pricing/model         계정 적용 가격 조회
```

금액 필드의 단위는 USD이며, `cost_credits`와 `credits`는 크레딧으로 USD × 10에 해당합니다.

***

## 요청 ID로 단건 조회

```text theme={null}
GET /v1/logs/requests/{id}
```

**id** `string` *required*

* 동기 호출: 응답 헤더 `X-Oneapi-Request-Id`의 값
* 비동기 작업: 제출 시 반환된 작업 ID

> [!NOTE]
>
> 로그는 비동기로 기록되며 보통 요청 종료 후 몇 초 안에 조회할 수 있습니다. `404 log_not_found`가 반환되면 잠시 후 다시 시도하세요. 비동기 작업은 작업 ID로 조회해야 하며, 작업이 완료되거나 실패한 후에 내역이 생성됩니다.

조회 범위는 API Key가 속한 계정 전체입니다. `data`는 배열이며, 같은 ID에 소비 내역과 실패 내역이 함께 있을 수 있습니다. 주요 필드:

| 필드 | 설명 |
| - | - |
| `id` | 요청 ID 또는 작업 ID |
| `type` | `consume`(소비) 또는 `error`(실패) |
| `created_at` | 기록 시각(Unix 초). 비동기 작업은 정산 시각 |
| `model_name` | 모델 이름 |
| `token_name` | 호출한 API Key 이름(내역 기록 시점의 이름이며 중복될 수 있음). 키를 정확히 구분하려면 동기화 엔드포인트에서 `token_id`로 필터링하세요 |
| `prompt_tokens` / `completion_tokens` | 입력 / 출력 토큰 수 |
| `cost_usd` | 해당 내역의 과금 금액(USD) |
| `cost_credits` | 과금 크레딧 |

`cost_usd`는 정산 후 최종 금액입니다. 실패 내역은 항상 `0`이며, 실패 환불은 내역 기록 전에 완료됩니다. `type`이 `consume`인 내역을 합산하면 호출로 발생한 과금액이 됩니다.

***

## 요청 로그 동기화

```text theme={null}
GET /v1/logs/requests
```

시간 범위로 계정의 모든 내역을 페이지 단위로 가져옵니다. 정기 정산 대조에 적합합니다. 각 내역의 필드는 단건 조회와 같습니다.

**start\_timestamp** `integer` *required*

시작 시각, Unix 초 타임스탬프.

**end\_timestamp** `integer`

종료 시각, Unix 초 타임스탬프. 기본값은 현재 시각입니다. 범위는 양 끝을 포함하며 31일을 넘을 수 없습니다.

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

내역 유형: `all`, `consume` 또는 `error`.

**model** `string`

모델 이름으로 필터링합니다.

**token\_id** `integer`

지정한 API Key의 내역만 반환합니다. ID는 콘솔의 'API 키' 목록에서 복사할 수 있습니다(키 이름 아래에 표시). 키를 교체해도 ID는 바뀌지 않습니다.

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

페이지당 건수, `1`–`1000`.

**cursor** `string`

페이지 커서. 이전 페이지의 `next_cursor`를 그대로 전달하세요. 페이지를 넘기는 동안 다른 파라미터는 바꾸지 마세요.

응답의 `has_more`는 다음 페이지 여부, `next_cursor`는 다음 페이지 커서, `watermark`는 서버 현재 시각에서 300초를 뺀 값입니다.

> [!TIP]
>
> **권장 동기화 방식**: 매 회차의 `end_timestamp`는 `watermark`보다 늦지 않게 하고, 다음 회차는 이전 회차 종료 시각보다 10분 앞에서부터 가져와 `(id, type)`으로 중복을 제거하며, 한 시간 윈도 안에서는 `has_more`가 `false`가 될 때까지 페이지를 넘깁니다.

***

## 계정 적용 가격 조회

```text theme={null}
GET /v1/pricing/model
```

현재 API Key가 속한 계정이 모델을 호출할 때의 실제 가격을 조회합니다. 전용 가격, 멤버십 가격, 그룹 배율, 할인이 모두 반영되어 호출 시 과금과 일치합니다. 가격 페이지에 표시되는 것은 공개 가격이므로, 계정 기준으로 견적을 내려면 이 엔드포인트를 사용하세요.

**model** `string` *required*

모델 이름. 별칭을 지원합니다.

**resolution** `string`

해상도 또는 등급. 모델이 지원하는 등급이어야 합니다.

**size** `string`

이미지 크기.

**quality** `string`

품질 등급.

**duration** `integer`

길이(초), `1`–`3600`. 초당 과금 모델에서 사용합니다.

**n** `integer`

생성 수량, `1`–`100`.

사양 파라미터를 전달하지 않으면 모델의 기본 사양으로 견적합니다. 초당 과금 모델에서 `duration`을 생략하면 초당 단가만 반환합니다.

주요 응답 필드:

| 필드 | 설명 |
| - | - |
| `unit` | 가격 단위: `per_image`, `per_call`, `per_second`, `per_million_tokens` |
| `unit_price_usd` | 단가(USD) |
| `total_usd` | 이 사양의 총 가격(USD) |
| `unit_prices` | 토큰 과금 모델에서 반환되는 100만 토큰당 단가(예: `input`, `output`) |
| `estimated` | `true`는 최종 과금이 실제 사용량(토큰 과금 등)에 따라 달라짐을 의미하며, 견적은 참고용입니다 |
| `price_source` | 가격 출처: `membership`(멤버십 가격), `user_override`(전용 가격), `group`(그룹 가격), `default`(표준 가격) |

API Key당 분당 최대 `60`회 조회할 수 있습니다.

***

## 오류 처리

| HTTP 상태 코드 | `error.code` | 설명 |
| - | - | - |
| 400 | `invalid_request_id` / `invalid_request` 등 | 파라미터가 올바르지 않음, 자세한 내용은 `message` 참고 |
| 400 | `time_range_too_large` | 로그 시간 범위가 31일 초과 |
| 401 / 402 / 403 | — | API Key가 유효하지 않거나 만료 또는 비활성화됨 |
| 404 | `log_not_found` | 로그 내역을 찾을 수 없음, 아직 기록되지 않았을 수 있음 |
| 404 | `model_not_found` / `no_valid_pricing` | 모델이 존재하지 않거나 가격이 없음 |
| 429 | — | 요청이 너무 많음 |
| 500 / 503 | — | 서비스를 일시적으로 사용할 수 없음, 잠시 후 다시 시도하세요 |


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