# Maya1

> Maya1 is a state-of-the-art speech model by Maya Research for expressive voice generation, built to capture real human emotion and precise voice design.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/maya`
- **Model ID**: `fal-ai/maya`
- **Category**: text-to-speech
- **Kind**: inference
**Tags**: text-to-speech, tts



## Pricing

Your request will cost **0.002** per generated **audio seconds**.

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`text`** (`string`, _required_):
  The text to synthesize into speech. You can embed emotion tags anywhere in the text using the format <emotion_name>. Available emotions: laugh, laugh_harder, sigh, chuckle, gasp, angry, excited, whisper, cry, scream, sing, snort, exhale, gulp, giggle, sarcastic, curious. Example: 'Hello world! <excited> This is amazing!' or 'I can't believe this <sigh> happened again.'
  - Examples: "Hello world! This is a test of the Maya-1-Voice text-to-speech system.", "The darkness isn't coming... <angry> it's already here!", "That's hilarious! <laugh> I can't stop <laugh_harder> thinking about it!", "<whisper> I have a secret to tell you. <excited> You won't believe what happened!"

- **`prompt`** (`string`, _required_):
  Description of the voice/character. Includes attributes like age, accent, pitch, timbre, pacing, tone, and intensity. See examples for format.
  - Examples: "Realistic male voice in the 30s age with american accent. Normal pitch, warm timbre, conversational pacing, neutral tone delivery at med intensity.", "Creative, dark_villain character. Male voice in their 40s with british accent. Low pitch, gravelly timbre, slow pacing, angry tone at high intensity."

- **`temperature`** (`float`, _optional_):
  Sampling temperature. Lower values (0.2-0.5) produce more stable/consistent audio. Higher values add variation. Default value: `0.4`
  - Default: `0.4`
  - Range: `0` to `2`

- **`top_p`** (`float`, _optional_):
  Nucleus sampling parameter. Controls diversity of token selection. Default value: `0.9`
  - Default: `0.9`
  - Range: `0` to `1`

- **`max_tokens`** (`integer`, _optional_):
  Maximum number of SNAC tokens to generate (7 tokens per frame). Controls maximum audio length. Default value: `2000`
  - Default: `2000`
  - Range: `28` to `4000`

- **`repetition_penalty`** (`float`, _optional_):
  Penalty for repeating tokens. Higher values reduce repetition artifacts. Default value: `1.1`
  - Default: `1.1`
  - Range: `1` to `2`

- **`sample_rate`** (`SampleRateEnum`, _optional_):
  Output audio sample rate. 48 kHz provides higher quality audio, 24 kHz is faster. Default value: `"48 kHz"`
  - Default: `"48 kHz"`
  - Options: `"48 kHz"`, `"24 kHz"`
  - Examples: "48 kHz", "24 kHz"

- **`output_format`** (`OutputFormatEnum`, _optional_):
  Output audio format for the generated speech Default value: `"wav"`
  - Default: `"wav"`
  - Options: `"wav"`, `"mp3"`
  - Examples: "wav", "mp3"



**Required Parameters Example**:

```json
{
  "text": "Hello world! This is a test of the Maya-1-Voice text-to-speech system.",
  "prompt": "Realistic male voice in the 30s age with american accent. Normal pitch, warm timbre, conversational pacing, neutral tone delivery at med intensity."
}
```

**Full Example**:

```json
{
  "text": "Hello world! This is a test of the Maya-1-Voice text-to-speech system.",
  "prompt": "Realistic male voice in the 30s age with american accent. Normal pitch, warm timbre, conversational pacing, neutral tone delivery at med intensity.",
  "temperature": 0.4,
  "top_p": 0.9,
  "max_tokens": 2000,
  "repetition_penalty": 1.1,
  "sample_rate": "48 kHz",
  "output_format": "wav"
}
```


### Output Schema

The API returns the following output format:

- **`audio`** (`File`, _required_):
  The generated audio file containing the speech (WAV or MP3 format, 24kHz or 48kHz mono depending on upsampler)

- **`duration`** (`float`, _required_):
  Duration of the generated audio in seconds
  - Examples: 4.5

- **`sample_rate`** (`string`, _required_):
  Sample rate of the generated audio
  - Examples: "48 kHz", "24 kHz"

- **`generation_time`** (`float`, _required_):
  Time taken to generate the audio in seconds
  - Examples: 2.3

- **`rtf`** (`float`, _required_):
  Real-time factor (generation_time / audio_duration). Lower is better.
  - Examples: 0.51



**Example Response**:

```json
{
  "audio": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019
  },
  "duration": 4.5,
  "sample_rate": "48 kHz",
  "generation_time": 2.3,
  "rtf": 0.51
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/maya \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "text": "Hello world! This is a test of the Maya-1-Voice text-to-speech system.",
     "prompt": "Realistic male voice in the 30s age with american accent. Normal pitch, warm timbre, conversational pacing, neutral tone delivery at med intensity."
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "fal-ai/maya",
    arguments={
        "text": "Hello world! This is a test of the Maya-1-Voice text-to-speech system.",
        "prompt": "Realistic male voice in the 30s age with american accent. Normal pitch, warm timbre, conversational pacing, neutral tone delivery at med intensity."
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/maya", {
  input: {
    text: "Hello world! This is a test of the Maya-1-Voice text-to-speech system.",
    prompt: "Realistic male voice in the 30s age with american accent. Normal pitch, warm timbre, conversational pacing, neutral tone delivery at med intensity."
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/fal-ai/maya)
- [API Documentation](https://fal.ai/models/fal-ai/maya/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/maya)

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
