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

# ElevenLabs 预设音色目录

> 返回预设音色目录，不扣 quota；保留音色 ID、试听地址等元数据。目录不是完整白名单，收录条目不保证账户访问权限或与全部模型及参数兼容。 不传 limit 和 offset 时保持返回完整数组；传入任一参数启用可选分页，响应仍为数组。目录更新通常不频繁，不承诺固定周期；首次下载或主动重新下载时，建议按页下载全部条目，合并并保存到本地，成功后再替换旧目录。语言、性别、名称等筛选由业务端或用户本地完成。

需要 Bearer Token，不扣 quota。返回音色目录数组，包含 voice\_id、name、description、languages、preview\_url 等元数据。试听 preview\_url 后，将音色 ID 填入 Speech 的 `voice_id` 或 Dialogue 的 `inputs[].voice_id`。目录不是完整白名单，未收录的已有音色 ID 仍可提交；条目收录不保证账户访问权限或与全部模型及参数兼容。空目录返回 \[]，目录不可用返回 503。

## 分页下载

目录更新通常不频繁，不承诺固定更新周期。首次下载和主动重新下载时，建议按页拉取全部条目，按返回顺序合并并保存到本地，全部成功后再替换旧目录。业务端或用户本地可按语言、性别、名称等元数据自行筛选；接口不提供这些筛选参数。

```http theme={null}
GET https://api.aihubmax.com/e/v1/configs/elevenlabs-preset-voice-id?limit=100&offset=0
Authorization: Bearer YOUR_API_KEY
```

不传 `limit` 和 `offset` 时，继续返回原来的完整数组。传入任一参数启用分页，响应仍为数组，条目顺序和元数据保持不变。

| 参数 | 规则 |
| - | - |
| `limit` | 每页上限，十进制整数 1–1000；只传 `offset` 时默认为 100 |
| `offset` | 从 0 开始的偏移量，非负十进制整数；分页时默认为 0 |

分页响应通过以下响应头提供进度，浏览器可直接读取：

| 响应头 | 含义 |
| - | - |
| `X-Total-Count` | 当前目录总条目数 |
| `X-Limit` | 实际采用的每页上限 |
| `X-Offset` | 本页偏移量 |
| `X-Next-Offset` | 下一页偏移量；空字符串表示结束 |

按 `X-Next-Offset` 继续请求，收到空字符串即停止；即使末页恰好填满 `limit`，也不需要额外请求。空目录、偏移量等于或超过总数时返回 `[]`，下一偏移量为空。非法参数返回 HTTP 400，`error.code` 为 `invalid_pagination`。分页期间不锁定目录快照；如果总数发生变化，请从 `offset=0` 重新下载。

## 完整下载示例

下面的 Python 示例适用于首次下载和主动重新下载。设置环境变量 `AIHUB_API_KEY` 后运行；下载失败时保留原本的 `elevenlabs-voices.json`。

```python theme={null}
import json
import os
from pathlib import Path
from urllib.request import Request, urlopen


def download_catalog(api_key):
    entries = []
    offset = 0
    total = None
    while True:
        url = (
            "https://api.aihubmax.com/e/v1/configs/elevenlabs-preset-voice-id"
            f"?limit=100&offset={offset}"
        )
        request = Request(url, headers={"Authorization": f"Bearer {api_key}"})
        with urlopen(request, timeout=60) as response:
            page = json.load(response)
            count = int(response.headers["X-Total-Count"])
            next_offset = response.headers.get("X-Next-Offset")
        if total is None:
            total = count
        if count != total or not isinstance(page, list) or next_offset is None:
            raise RuntimeError("Catalog changed or pagination is unavailable; retry from offset=0")
        entries.extend(page)
        if next_offset == "":
            if len(entries) != total:
                raise RuntimeError("Incomplete catalog; keep the previous local copy")
            return entries
        if not page or int(next_offset) != len(entries):
            raise RuntimeError("Invalid pagination progress; keep the previous local copy")
        offset = int(next_offset)


catalog = download_catalog(os.environ["AIHUB_API_KEY"])
target = Path("elevenlabs-voices.json")
staged = target.with_suffix(".download.json")
staged.write_text(json.dumps(catalog, ensure_ascii=False), encoding="utf-8")
staged.replace(target)
```


## OpenAPI

````yaml openapi/zh/configs-elevenlabs-preset-voice-id.json GET /v1/configs/elevenlabs-preset-voice-id
openapi: 3.1.0
info:
  title: ElevenLabs 预设音色目录
  version: '1.0'
servers:
  - url: https://api.aihubmax.com/e
security:
  - BearerAuth: []
paths:
  /v1/configs/elevenlabs-preset-voice-id:
    get:
      tags:
        - Config Query
      summary: ElevenLabs 预设音色目录
      description: >-
        返回预设音色目录，不扣 quota；保留音色 ID、试听地址等元数据。目录不是完整白名单，收录条目不保证账户访问权限或与全部模型及参数兼容。
        不传 limit 和 offset
        时保持返回完整数组；传入任一参数启用可选分页，响应仍为数组。目录更新通常不频繁，不承诺固定周期；首次下载或主动重新下载时，建议按页下载全部条目，合并并保存到本地，成功后再替换旧目录。语言、性别、名称等筛选由业务端或用户本地完成。
      operationId: configs-elevenlabs-preset-voice-id
      parameters:
        - name: limit
          in: query
          required: false
          description: >-
            每页最多返回的条目数，十进制整数 1–1000。传入 limit 或 offset 即启用分页；只传 offset 时 limit
            默认为 100。不传两者时返回全量数组。
          schema:
            type: integer
            minimum: 1
            maximum: 1000
          example: 100
        - name: offset
          in: query
          required: false
          description: >-
            从 0 开始的条目偏移量，非负十进制整数；分页时默认为
            0。沿原目录顺序返回，保留全部元数据。等于或超过总数时返回空数组，X-Next-Offset 为空。
          schema:
            type: integer
            minimum: 0
            default: 0
          example: 0
      responses:
        '200':
          description: >-
            目录数组；分页只改变返回范围，保留原数组结构。空目录或越界页返回 []。以下响应头仅在分页请求中返回，并通过
            Access-Control-Expose-Headers 向浏览器开放。
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ElevenLabsVoicePreset'
              example:
                - voice_id: 004KTmksPwLFhbYi3ENc
                  name: Zak - Male, Welsh Native
                  description: Casual voice nationality Welsh/English.
                  languages:
                    - en
                    - pt
                    - ar
                    - it
                    - es
                    - ko
                    - uk
                    - hi
                    - de
                    - 'no'
                    - hr
                    - cs
                    - vi
                    - pl
                    - sv
                  accent: british
                  gender: male
                  age: middle_aged
                  category:
                    - high_quality
                  preview_url: >-
                    https://storage.googleapis.com/eleven-public-prod/database/workspace/20f2f3fe22fc43f49c5fedebde76fac4/voices/004KTmksPwLFhbYi3ENc/2a637b54-34f0-48a2-b396-50eb4f3aedad.mp3
                  notice_period_days: 730
          headers:
            X-Total-Count:
              description: 目录总条目数。
              schema:
                type: integer
                minimum: 0
              example: 15450
            X-Limit:
              description: 本次实际采用的每页上限。
              schema:
                type: integer
                minimum: 1
                maximum: 1000
              example: 100
            X-Offset:
              description: 本页从 0 开始的偏移量。
              schema:
                type: integer
                minimum: 0
              example: 0
            X-Next-Offset:
              description: 下一页偏移量的十进制字符串；末页、空目录或越界时为空字符串，收到空字符串即停止。
              schema:
                type: string
              example: '100'
        '400':
          description: >-
            limit 或 offset 非法（空值、非十进制整数、负数，或 limit 不在 1–1000）；error.code 为
            invalid_pagination。
        '401':
          description: Token 无效或缺失。
        '503':
          description: 音色目录暂不可用。
components:
  schemas:
    ElevenLabsVoicePreset:
      type: object
      required:
        - voice_id
      additionalProperties: true
      properties:
        voice_id:
          type: string
          description: 填入 Speech voice_id 或 Dialogue inputs[].voice_id 的音色 ID。
          minLength: 1
        name:
          type:
            - string
            - 'null'
          description: 音色展示名称。
        description:
          type:
            - string
            - 'null'
          description: 音色描述。
        languages:
          type:
            - array
            - 'null'
          description: 支持的语言代码。
          items:
            type: string
        accent:
          type:
            - string
            - 'null'
          description: 口音。
        gender:
          type:
            - string
            - 'null'
          description: 性别描述。
        age:
          type:
            - string
            - 'null'
          description: 年龄标签。
        category:
          type:
            - array
            - 'null'
          description: 分类标签。
          items:
            type: string
        preview_url:
          type:
            - string
            - 'null'
          description: 试听音频地址。
        notice_period_days:
          type:
            - integer
            - 'null'
          description: 目录中保留的通知期天数。
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

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