跳到主要內容
API 參考
API 參考

Fish Audio 聲音列表

使用列出聲音端點,以在同一回應中接收結果。

01

概覽

使用列出聲音端點,並從同一回應中讀取結果。

快速入門

  1. 建立 API 金鑰並將其設定為 RUNAPI_API_KEY。
  2. 傳送一個 POST 請求,其主體符合請求結構描述。
  3. 從成功的回應主體中讀取結果。

端點

GET /api/v1/fish_audio/voices
基礎 URL
https://runapi.ai
API 版本
v1
身分驗證
Authorization: Bearer YOUR_API_TOKEN
02

支援的模型

開啟模型頁面以查看目前的定價、速率限制及商業用途詳情。

03

請求綱要

JSON 請求內文

僅傳送此端點宣告的欄位。

請求主體2 個欄位
page_numberinteger
選填 預設值: 1 邊界: 1
page_sizeinteger
選填 預設值: 10 範圍: 1 - 100
04

成功回應

HTTP 200

GET /api/v1/fish_audio/voices

回應綱要
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "page_number": {
      "type": "integer"
    },
    "page_size": {
      "type": "integer"
    },
    "total": {
      "type": "integer"
    },
    "voices": {
      "items": {
        "properties": {
          "name": {
            "type": "string"
          },
          "state": {
            "enum": [
              "created",
              "training",
              "trained",
              "failed"
            ],
            "type": "string"
          },
          "voice_id": {
            "type": "string"
          }
        },
        "required": [
          "voice_id",
          "state"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "voices",
    "total",
    "page_number",
    "page_size",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

回應範例

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "page_number": 1,
  "page_size": 10,
  "total": 1,
  "voices": [
    {
      "name": "Studio Narrator",
      "state": "trained",
      "voice_id": "voice_reference_narrator"
    }
  ]
}
05

錯誤

HTTP 401

GET /api/v1/fish_audio/voices

回應綱要
JSON
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

回應範例

JSON
{
  "error": "Authentication required"
}
06

錯誤

HTTP 400

GET /api/v1/fish_audio/voices

回應綱要
JSON
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "人類可讀的錯誤訊息。",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "人類可讀的驗證摘要。",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "以公開請求欄位為索引鍵的驗證訊息,每個欄位包含一組人類可讀的字串陣列。",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}

回應範例

JSON
{
  "error": "page_number must be greater than or equal to 1"
}
07

錯誤

HTTP 402

GET /api/v1/fish_audio/voices

回應綱要
JSON
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

回應範例

JSON
{
  "error": "Insufficient balance"
}
08

錯誤

HTTP 429

GET /api/v1/fish_audio/voices

回應綱要
JSON
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

回應範例

JSON
{
  "error": "API key credit limit exceeded"
}
09

錯誤

HTTP 409

GET /api/v1/fish_audio/voices

回應綱要
JSON
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

回應範例

JSON
{
  "error": "The request uses features that are not supported for the selected model"
}
10

錯誤

HTTP 429

GET /api/v1/fish_audio/voices

回應綱要
JSON
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

回應範例

JSON
{
  "error": "Rate limit reached. Please retry later."
}
11

錯誤

HTTP 503

GET /api/v1/fish_audio/voices

回應綱要
JSON
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

回應範例

JSON
{
  "error": "Service under maintenance, please try again later"
}
12

錯誤

HTTP 504

GET /api/v1/fish_audio/voices

回應綱要
JSON
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

回應範例

JSON
{
  "error": "The request timed out"
}
13

產生的程式碼範例

直接使用 cURL,或為您的程式語言安裝 SDK。每個範例均會提交本參考中所示的已驗證請求。

安裝

Shell
pip install runapi-fish-audio
PYTHON
import os
from runapi.fish_audio import FishAudioClient

client = FishAudioClient(api_key=os.environ["RUNAPI_API_KEY"])
result = client.list_voices.run(
  page_number=1,
  page_size=10
)