# Hlasové API pro vývojáře

> Tento průvodce zatím nebyl přeložen. Níže je zobrazena anglická verze. [Přečíst anglický originál](https://docs.helixvoice.net/en/api/speech/)

Generate speech, manage owned voices, and transcribe Mandarin audio.

Use `https://api.helixvoice.net` with the versioned paths below and a production [API key](/cs/api/authentication/). Each endpoint requires its listed scope. Calls run on your application server.

## Read capabilities

Scope: `capabilities:read`.

```http
GET /v1/capabilities
```

The `data` object describes the connected environment. Relevant fields include `maxTextCharacters`, `maxUploadBytes`, `maxTranscriptionSeconds`, `transcriptionLanguages`, `userDailyLimit`, `requestsPerMinute`, `historyDays`.

Read these limits before uploads or generation. They can differ from the defaults in this documentation.

## List voices

Scope: `voices:read`.

```http
GET /v1/voices
```

Returns available public and account-owned private voices. Use a returned voice `id` for generation. Metadata includes the name, language, and other catalog descriptors.

## Generate speech

Scope: `speech:write`.

```sh
curl --fail-with-body \
  'https://api.helixvoice.net/v1/audio/speech' \
  -H "Authorization: Bearer ${HELIXVOICE_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{"input":"Hello, welcome to Helix Voice.","voice":"demo"}'
```

| Field   | Type   | Description                                            |
| ------- | ------ | ------------------------------------------------------ |
| `input` | string | Required text within the environment’s character limit |
| `voice` | string | Required public or owned voice ID                      |

HTTP 200 returns a JSON `data` object with `id`, `text`, `voice`, `durationMs`, `createdAt`, and `audioPath`. This generation request returns metadata; download the non-streaming WAV separately using `audioPath` and a key with `generations:read` from the same account. `audioPath` starts with `/v1/generations/`; resolve it against `https://api.helixvoice.net`.

## History and audio

GET requires `generations:read`; DELETE requires `generations:write`.

| Method | Path                         | Result                                     |
| ------ | ---------------------------- | ------------------------------------------ |
| GET    | `/v1/generations`            | Up to 100 recent unexpired account records |
| GET    | `/v1/generations/{id}/audio` | Authenticated WAV bytes                    |
| DELETE | `/v1/generations/{id}`       | Delete an owned record and its audio       |

```sh
curl --fail-with-body \
  'https://api.helixvoice.net/v1/generations/<generation-id>/audio' \
  -H "Authorization: Bearer ${HELIXVOICE_API_KEY}" \
  --output speech.wav
```

Replace `<generation-id>` with the successful generation ID. Check the status and content type before playing the output. The audio resource is private and subject to [retention](/cs/guides/history/).

## Create and delete a private voice

Scope: `voices:write`.

```sh
curl --fail-with-body \
  'https://api.helixvoice.net/v1/voices' \
  -H "Authorization: Bearer ${HELIXVOICE_API_KEY}" \
  -F 'file=@reference.wav' \
  -F 'name=My voice' \
  -F 'language=en-US' \
  -F 'transcript=These are the exact words in my reference recording.' \
  -F 'consent=true'
```

All five fields are required. `language` accepts `zh-CN` or `en-US`. Use an accurate transcript, a 1–30 second reference, and a file within the upload limit. Do not manually set Content-Type for multipart uploads; curl supplies the boundary.

Delete an owned private voice with `DELETE /v1/voices/{id}`.

## Transcribe a file

Scope: `transcriptions:write`.

```sh
curl --fail-with-body \
  'https://api.helixvoice.net/v1/audio/transcriptions' \
  -H "Authorization: Bearer ${HELIXVOICE_API_KEY}" \
  -F 'file=@mandarin.wav' \
  -F 'language=zh-CN'
```

`file` is required. `language` defaults to `zh-CN` and also accepts `auto`; the deployed capability remains Mandarin. Successful `data.text` contains the transcript. The default duration limit is 180 seconds and the upload limit is 20 MiB.

## Handle responses

Successful JSON operations return `data`. Deletion returns HTTP 204 with no body. Failures use HTTP error statuses and `error`. Every authorized request counts toward key request limits, including lists and downloads. Speech operations also share the account and global budgets. See [errors and rate limits](/cs/api/errors/).
