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

# 查询对话账单

查询指定对话的账单明细信息，对话ID`uuid`可以通过[对话接口](https://docs.geekai.co/cn/api/chat/completions)响应数据中的`id`字段获取，对于画图、视频生成等场景，需要通过响应数据的`task_id`进行查询。

查询结果中的 `amount` 字段表示此次对话消耗的金币数，单位为金币，100金币=1元。

<Note>
  注意：调用此接口需要通过[系统 KEY](https://geekai.co/user/provision_keys) 进行认证。此外，由于账单是异步生成的，拿到对话/任务响应结果后可能需要等待一段时间才能查询到对应的账单信息，这个时间通常是1-3s左右。
</Note>


## OpenAPI

````yaml adminapi.yaml GET /chat/transaction/{uuid}
openapi: 3.1.0
info:
  title: 极客智坊 API 文档
  description: 极客智坊 API KEY 管理文档 提供 API KEY 的创建、删除、修改、查询功能
  version: 1.0.0
servers:
  - url: https://geekai.co/api
    description: 国内调用入口
  - url: https://geekai.dev/api
    description: 海外调用入口
security:
  - bearerAuth: []
paths:
  /chat/transaction/{uuid}:
    get:
      tags:
        - CHAT_TRANSACTION
      summary: 查询对话账单
      description: 查询指定对话的账单明细
      operationId: getChatTransaction
      parameters:
        - $ref: '#/components/parameters/UuidParam'
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  request_id:
                    type: string
                    description: 对话请求ID
                  amount:
                    type: number
                    description: 本次请求消耗金币值，100金币=1元
                  tokens:
                    type: number
                    description: 使用的总Token数量
                  input_tokens:
                    type: number
                    description: 输入Token数量
                  output_tokens:
                    type: number
                    description: 输出Token数量
                  cache_hit_tokens:
                    type: number
                    description: 缓存命中Token数量
                  cache_write_tokens:
                    type: number
                    description: 缓存写入Token数量
                  billed_units:
                    type: number
                    description: 计费单位数量，适用于按次收费模型，如搜索、画图、视频生成等
                  times:
                    type: number
                    description: 计费倍率，适用于不同分辨率、质量的画图、视频生成等模型，默认为1
                  event:
                    type: string
                    description: 事件类型，表示此次对话的具体操作类型
                  channel:
                    type: string
                    description: 代理线路渠道类型枚举值，如低价、均衡、高可用等
                  discount:
                    type: number
                    description: 折扣率，消耗金币=官方价*折扣率
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/StandardError'
components:
  parameters:
    UuidParam:
      name: uuid
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: 资源唯一标识符
      example: 123e4567-e89b-12d3-a456-426614174000
  responses:
    Unauthorized:
      description: 未授权
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: unauthorized
              message:
                type: string
                example: Invalid API key or token
    StandardError:
      description: 标准错误响应
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: 错误代码
          example: invalid_request
        message:
          type: string
          description: 错误信息描述
          example: 请求参数不合法
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 系统KEY

````