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

# 현재 API 키 가져오기

> CometAPI GET /api/usage/token을 사용해 bearer API 키의 quota, usage, 만료, 모델 제한 세부 정보를 조회합니다.

이 엔드포인트를 사용하면 요청에 사용된 CometAPI API 키를 확인할 수 있습니다. 이 엔드포인트는 모든 키의 계정 수준 목록이 아니라 bearer 키의 usage 및 quota 필드를 반환합니다.

<Note>
  이 엔드포인트는 CometAPI API 키를 사용합니다: `Authorization: Bearer $COMETAPI_KEY`. API 키 관리 엔드포인트는 별도의 personal access token을 사용합니다.
</Note>

## 반환 필드

| Field                  | Type    | Description                                                               |
| ---------------------- | ------- | ------------------------------------------------------------------------- |
| `name`                 | string  | API 키의 표시 이름입니다.                                                          |
| `total_granted`        | integer | 이 키에 할당된 총 quota로, CometAPI 내부 quota 단위를 사용합니다.                           |
| `total_used`           | integer | 이 키가 소비한 quota로, CometAPI 내부 quota 단위를 사용합니다.                             |
| `total_available`      | integer | 이 키에 남아 있는 quota로, CometAPI 내부 quota 단위를 사용합니다.                           |
| `unlimited_quota`      | boolean | 이 키가 남은 quota 검사 여부를 우회하는지 나타냅니다.                                         |
| `model_limits`         | object  | 이 키의 모델 제한입니다. model ID를 키로 사용합니다. 모델 제한이 구성되지 않은 경우 비어 있습니다.             |
| `model_limits_enabled` | boolean | 이 키에 대해 모델 제한이 활성화되어 있는지 나타냅니다.                                           |
| `expires_at`           | integer | 키가 만료되는 시점을 나타내는 초 단위 Unix timestamp입니다. 이 usage 응답에서 `0`은 만료가 없음을 의미합니다. |


## OpenAPI

````yaml api/openapi/api-keys/get-current-api-key.openapi.json GET /api/usage/token
openapi: 3.1.0
info:
  title: Get Current API Key
  version: 1.0.0
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /api/usage/token:
    get:
      summary: Get current API key
      description: >-
        Retrieve usage, quota, expiration, and model-limit details for the
        CometAPI API key sent in the bearer Authorization header.
      operationId: getCurrentApiKey
      responses:
        '200':
          description: Current API key usage details.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - data
                properties:
                  code:
                    type: boolean
                    description: Whether the request succeeded.
                  message:
                    type: string
                    description: Status message.
                  data:
                    type: object
                    required:
                      - object
                      - name
                      - total_granted
                      - total_used
                      - total_available
                      - unlimited_quota
                      - model_limits
                      - model_limits_enabled
                      - expires_at
                    properties:
                      object:
                        type: string
                        description: Object type.
                        example: token_usage
                      name:
                        type: string
                        description: >-
                          Display name of the bearer API key used by the
                          request.
                        example: production
                      total_granted:
                        type: integer
                        description: >-
                          Total quota assigned to this key in CometAPI internal
                          quota units.
                        example: 150000
                      total_used:
                        type: integer
                        description: >-
                          Quota consumed by this key in CometAPI internal quota
                          units.
                        example: 50000
                      total_available:
                        type: integer
                        description: >-
                          Remaining quota available to this key in CometAPI
                          internal quota units.
                        example: 100000
                      unlimited_quota:
                        type: boolean
                        description: Whether the key bypasses remaining-quota checks.
                        example: false
                      model_limits:
                        type: object
                        description: >-
                          Model restrictions for this key, keyed by model ID.
                          Empty when no model limits are configured.
                        additionalProperties:
                          type: boolean
                        example: {}
                      model_limits_enabled:
                        type: boolean
                        description: Whether model restrictions are active for this key.
                        example: false
                      expires_at:
                        type: integer
                        description: >-
                          Unix timestamp in seconds when the key expires. `0`
                          means no expiration in this usage response.
                        example: 0
              examples:
                success:
                  summary: Current key usage
                  value:
                    code: true
                    message: ok
                    data:
                      object: token_usage
                      name: production
                      total_granted: 150000
                      total_used: 50000
                      total_available: 100000
                      unlimited_quota: false
                      model_limits:
                        gpt-4.1: true
                      model_limits_enabled: true
                      expires_at: 0
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl https://api.cometapi.com/api/usage/token \
              -H "Authorization: Bearer $COMETAPI_KEY"
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: CometAPI API key
      description: >-
        CometAPI API key used for model requests. Send it as `Authorization:
        Bearer $COMETAPI_KEY`.

````