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

# Gemini 显式上下文缓存 - 查询缓存列表

> 列出当前账号下所有**未过期**的缓存（按账号归属，不区分 Key），按到期时间倒序排列。已过期、已删除的不在列表里。免费。

> [!NOTE]
>
> **BaseURL 说明**：默认 BaseURL 为 `https://direct.evolink.ai`，对文本模型支持更好，支持长连接；`https://api.evolink.ai` 是多模态主力地址，对文本模型作为备用地址使用。

> [!NOTE]
>
> 只返回当前账号下未过期的缓存，按到期时间倒序排列。查询免费。


## OpenAPI

````yaml cn/api-manual/language-series/gemini/cached-contents/cached-contents.json GET /v1beta/cachedContents
openapi: 3.1.0
info:
  title: Gemini 显式上下文缓存（cachedContents）
  description: >-
    把反复使用的长前缀（长文档、系统指令、工具定义）一次创建成缓存，后续生成请求只带缓存名和新问题；缓存部分按「缓存命中」单价计费。接口格式与 Gemini
    原生 cachedContents 接口一致。
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 生产环境（推荐）
  - url: https://api.evolink.ai
    description: 备用地址
security:
  - bearerAuth: []
tags:
  - name: 显式上下文缓存
    description: 创建、查询、延长、删除 Gemini 显式缓存
paths:
  /v1beta/cachedContents:
    get:
      tags:
        - 显式上下文缓存
      summary: 查询缓存列表
      description: 列出当前账号下所有**未过期**的缓存（按账号归属，不区分 Key），按到期时间倒序排列。已过期、已删除的不在列表里。免费。
      operationId: geminiListCachedContents
      parameters:
        - name: pageSize
          in: query
          required: false
          description: 每页条数，默认 50，最大 200。
          schema:
            type: integer
            default: 50
            maximum: 200
        - name: pageToken
          in: query
          required: false
          description: 上一页响应里的 `nextPageToken`；第一页不填。
          schema:
            type: string
      responses:
        '200':
          description: 缓存列表。还有下一页时带 `nextPageToken`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListCachedContentsResponse'
              example:
                cachedContents:
                  - name: cachedContents/20261103012026348092000s1oTuB96
                    model: models/gemini-3.8-flash
                    displayName: product-manual-v3
                    createTime: '2026-11-03T01:20:27.311Z'
                    updateTime: '2026-11-03T01:20:27.311Z'
                    expireTime: '2026-11-03T02:20:26.902Z'
                    usageMetadata:
                      totalTokenCount: 7525
                nextPageToken: '50'
        '400':
          description: pageToken 不合法
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400
                  message: invalid pageToken
                  status: INVALID_ARGUMENT
                  details:
                    - '@type': type.googleapis.com/google.rpc.ErrorInfo
                      reason: INVALID_ARGUMENT
                      domain: evolink.ai
        '401':
          description: API Key 无效或缺失
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message: Invalid API key
                  status: UNAUTHENTICATED
        '403':
          description: Key 无权使用该模型，或来源 IP 不在 Key 的白名单内
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 403
                  message: This key is not allowed to use model gemini-3.8-flash
                  status: PERMISSION_DENIED
        '404':
          description: 显式缓存功能未开放
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 404
                  message: explicit context caching is not enabled
                  status: NOT_FOUND
                  details:
                    - '@type': type.googleapis.com/google.rpc.ErrorInfo
                      reason: EXPLICIT_CACHE_DISABLED
                      domain: evolink.ai
        '429':
          description: 触发频率限制
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 429
                  message: Rate limit exceeded
                  status: RESOURCE_EXHAUSTED
        '503':
          description: 服务暂时不可用，请稍后重试
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 503
                  message: explicit context caching is temporarily unavailable
                  status: UNAVAILABLE
                  details:
                    - '@type': type.googleapis.com/google.rpc.ErrorInfo
                      reason: INTERNAL
                      domain: evolink.ai
components:
  schemas:
    ListCachedContentsResponse:
      type: object
      properties:
        cachedContents:
          type: array
          items:
            $ref: '#/components/schemas/CachedContent'
        nextPageToken:
          type: string
          description: 还有下一页时返回，原样放到下一次请求的 `pageToken`
    ErrorResponse:
      type: object
      description: >-
        Gemini 原生错误格式。`error.details[0].reason` 为原因码：`INVALID_ARGUMENT`
        参数错误；`EXPLICIT_CACHE_UNSUPPORTED`
        模型不支持显式缓存；`NO_AVAILABLE_CHANNEL`、`MODEL_PRICE_ERROR`
        当前用户组暂未开放；`CACHE_EXPIRED` 缓存已到期或剩余有效期过短；`CACHE_MODEL_MISMATCH`
        模型与缓存不一致；`INVALID_CACHED_CONTENT` `cachedContent`
        格式不正确；`INSUFFICIENT_QUOTA` 余额不足；`CACHE_NOT_FOUND`
        缓存不存在、已过期、已删除或不属于当前账号；`EXPLICIT_CACHE_DISABLED`
        功能暂未开放；`CACHE_CONTENT_TOO_LARGE` 请求体超过 10 MB；`UPSTREAM_ERROR` 请求未被接受，原因见
        `message`；`CACHE_CHANNEL_UNAVAILABLE`、`INTERNAL` 暂时不可用，请稍后重试。
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP 状态码
            message:
              type: string
            status:
              type: string
              description: 状态枚举，如 INVALID_ARGUMENT / NOT_FOUND / UNAVAILABLE
            details:
              type: array
              items:
                type: object
                properties:
                  '@type':
                    type: string
                    example: type.googleapis.com/google.rpc.ErrorInfo
                  reason:
                    type: string
                    example: CACHE_NOT_FOUND
                  domain:
                    type: string
                    example: evolink.ai
    CachedContent:
      type: object
      properties:
        name:
          type: string
          description: >-
            缓存名，形如 `cachedContents/<id>`。生成请求的 `cachedContent` 字段填它；`<id>`
            同时是创建请求的请求号
          example: cachedContents/20261103012026348092000s1oTuB96
        model:
          type: string
          description: 缓存绑定的模型，引用时生成请求的模型必须与之一致
          example: models/gemini-3.8-flash
        displayName:
          type: string
          description: 创建时给的名字，没给则不返回
        createTime:
          type: string
          format: date-time
          description: 创建时间（UTC）
        updateTime:
          type: string
          format: date-time
          description: 最近一次更新时间（UTC）
        expireTime:
          type: string
          format: date-time
          description: 到期时间（UTC），到期后自动删除
        usageMetadata:
          type: object
          properties:
            totalTokenCount:
              type: integer
              description: 缓存的 token 总数，缓存写入费与存储费按它计算
              example: 7525
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        ##所有接口均需要使用 Bearer Token 进行认证##


        **获取 API Key：**


        访问 [API Key 管理页面](https://evolink.ai/dashboard/keys) 获取您的 API Key


        **使用时在请求头中添加：**

        ```

        Authorization: Bearer YOUR_API_KEY

        ```


        也接受 Gemini 原生写法：请求头 `x-goog-api-key: YOUR_API_KEY`，或 URL 参数
        `?key=YOUR_API_KEY`。

````

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