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

# 生成查询

> 按 id 查询一次生成的费用和 token 数。

## Endpoint

```
GET https://vibetoken.cn/v1/generation?id={generation_id}
```

返回你的某一次生成的费用和 token 数，结构与 OpenRouter 的 `GET /api/v1/generation`
相同。当响应本身无法携带费用时使用：`POST /v1/audio/speech` 返回原始音频，它的
`X-Generation-Id` 响应头就是要查询的 id。任意生成都可以查询：对话补全的 `gen-...`
id、Responses API 的 `resp_...` id，或 embedding、图片、视频、音频、3D 生成的 id。图片、视频、音频和 3D 的 JSON 响应本身已带有
`usage.cost`（见 [费用与用量](https://docs.vibetoken.cn/zh/essentials/async-tasks.md#费用与用量)）。

## Request Headers

| Header | Value |
| - | - |
| `Authorization` | `Bearer sk-rb-xxxxxxxxxxxx` |

## Query Parameters

**id** `string` *required*

生成 id：`/v1/audio/speech` 返回的 `X-Generation-Id`、对话补全的 `id`（`gen-...`）、
Responses API 响应的 `id`（`resp_...`），或 embedding、图片、视频、音频、3D 生成的 `id`。

## Example

```bash theme={null}
curl "https://vibetoken.cn/v1/generation?id=f47ac10b-58cc-4372-a567-0e02b2c3d479" \
  -H "Authorization: Bearer sk-rb-xxxxxxxxxxxx"
```

## Response

示例值：

```json theme={null}
{
  "data": {
    "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "model": "vendor/model-name",
    "api_type": "tts",
    "status": "success",
    "error_message": null,
    "created_at": "2026-11-16T09:30:00Z",
    "latency": 1840,
    "total_cost": 0.0042,
    "usage": 0.0042,
    "tokens_prompt": null,
    "tokens_completion": null,
    "native_tokens_prompt": null,
    "native_tokens_completion": null,
    "native_tokens_cached": null,
    "native_tokens_completion_images": null,
    "num_media_completion": 1
  }
}
```

| Field | Meaning |
| - | - |
| `id` | 你查询的 id。 |
| `model` | 模型 id。 |
| `api_type` | `completions`、`embeddings`、`image`、`video` 或 `tts`（语音及其他音频）；3D 为 `null`。 |
| `status` | `success` 或 `failed`。VibeToken 自有字段，OpenRouter 的响应中没有。 |
| `error_message` | 生成失败的原因；成功时为 `null`。VibeToken 自有字段。 |
| `created_at` | 生成提交的时间（ISO 8601，UTC）。 |
| `latency` | 生成耗时（毫秒），有记录时提供。 |
| `total_cost`、`usage` | 该生成实际扣费的金额，单位为账户余额币种（两个字段金额相同，与 OpenRouter 一致）。失败的生成不扣费，为 `0`。 |
| `tokens_prompt`、`tokens_completion` | token 数：对话补全或 embedding 的 token 数，或按 token 用量计费的媒体模型自己上报的值。没有时为 `null`。 |
| `native_tokens_prompt`、`native_tokens_completion` | 模型上报的同一组 token 数。 |
| `native_tokens_cached` | 缓存命中的输入 token 数，上报时提供。 |
| `native_tokens_completion_images` | 图像输出 token 数，上报时提供。 |
| `num_media_completion` | 返回的图片、视频、音频片段或模型文件数量；对话和 embedding 为 `null`。 |

## Errors

| Status | When |
| - | - |
| `404` | 你的账户中没有该 id 的生成，或它尚未完成：费用在生成完成后才可查询。 |
| `401` | API key 缺失或无效。 |

错误体格式见 [错误码](https://docs.vibetoken.cn/zh/essentials/errors.md)。


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