# Kotoba Text-to-Speech v2

> Natural Japanese and English speech with preset voices and audio streamed as it is generated.


## Overview

- **Endpoint**: `https://fal.run/kotoba-technologies/kotoba-tts/v2/tts`
- **Model ID**: `kotoba-technologies/kotoba-tts/v2/tts`
- **Category**: text-to-speech
- **Kind**: inference
**Description**: ## Kotoba Text-to-Speech v2

Generate natural Japanese and English speech using preset speakers. Production streaming returns audio chunks as synthesis proceeds, allowing playback to begin before the entire utterance is ready. Useful for conversational agents, notifications, e-learning, accessibility, and character voices.

### Playground demo
The Playground provides a one-shot demonstration, not a streaming interface. Enter text, choose a language and speaker, and receive a WAV audio file. Maximum demo input: 400 characters.

### Streaming API
Use the Kotoba Python SDK or a WebSocket client at `wss://fal.run/Kotoba-Technologies/kotoba-tts/v2/tts/ws`. Send text with the language and speaker ID and receive base64 audio chunks. Output is 24 kHz PCM by default; 16-bit PCM and Opus are available, with resampling.

### Pricing
$0.015 per 1,000 UTF-8 bytes of input text. Billing counts UTF-8 bytes, not characters or output audio seconds.

**Tags**: commercial-use, text-to-speech, japanese, english, preset-voices



## Pricing

Kotoba TTS: $0.015 per 1,000 UTF-8 bytes of input text; 1 billable unit = 1,000 UTF-8 bytes.

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_):
  Japanese text to speak, up to 400 characters.

- **`language`** (`LanguageEnum`, _required_):
  Language of the text.
  - Options: `"ja"`

- **`speaker_id`** (`SpeakerIdEnum`, _required_):
  Voice.
  - Options: `"male-01"`, `"female-01"`



**Required Parameters Example**:

```json
{
  "text": "",
  "language": "ja",
  "speaker_id": "male-01"
}
```


### Output Schema

The API returns the following output format:

- **`audio`** (`MediaFile`, _required_):
  Synthesized speech (WAV, 24 kHz mono, 16-bit) as a link to the file.

- **`text`** (`string`, _required_):
  The text that was synthesized.

- **`audio_duration_secs`** (`float`, _required_):
  Seconds of synthesized speech.



**Example Response**:

```json
{
  "audio": {
    "content_type": "",
    "file_name": "",
    "url": ""
  },
  "text": ""
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/kotoba-technologies/kotoba-tts/v2/tts \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "text": "",
     "language": "ja",
     "speaker_id": "male-01"
   }'
```

### 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(
    "kotoba-technologies/kotoba-tts/v2/tts",
    arguments={
        "text": "",
        "language": "ja",
        "speaker_id": "male-01"
    },
    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("kotoba-technologies/kotoba-tts/v2/tts", {
  input: {
    text: "",
    language: "ja",
    speaker_id: "male-01"
  },
  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);
```


## Deploy your own model

To run your own weights, a fine-tune or a custom pipeline on the GPUs that serve this API, deploy it on fal Serverless. GPUs from H100 (80GB) to B300 (288GB), billed per second; an H100 is $4.50/h list, as low as $2.49/h. Prices, GPU specs and deploy steps: [fal Serverless](https://fal.ai/serverless.md).

## Additional Resources

### Documentation

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

### 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
- [Pricing](https://fal.ai/pricing.md): Model API and Serverless GPU prices
- [fal Serverless](https://fal.ai/serverless.md): Deploy your own models: GPU prices, specs and steps
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
