---
agent:
  instructions: "Search the site by keyword or question. The search API returns Markdown."
  endpoint: "https://platform.invideo.io/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Gemini 3.1 Flash TTS API

Model id: `gemini-3-1-flash-tts` · Google · Audio

## invideo API

Set the base URL to `https://platform-api.invideo.io/v1`. Use `Authorization: Bearer $INVIDEO_API_KEY` for authentication.

Endpoint `POST /v1/request` · Model ID in `model`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/v1/request' \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "model": "gemini-3-1-flash-tts",
    "mode": "generate",
    "input": {
      "prompt": "The afternoon light is soft and warm.",
      "voice_1": "Zephyr"
    }
  }'
```

### HTTP · Python

```python
import json
import os
from pathlib import Path
from uuid import uuid4

import requests

headers = {name: value.replace("$INVIDEO_API_KEY", os.environ["INVIDEO_API_KEY"])
           for name, value in json.loads("{\"Authorization\":\"Bearer $INVIDEO_API_KEY\",\"Content-Type\":\"application/json\"}").items()}
response = requests.post("https://platform-api.invideo.io/v1/request", headers=headers, json=json.loads("{\"model\":\"gemini-3-1-flash-tts\",\"mode\":\"generate\",\"input\":{\"prompt\":\"The afternoon light is soft and warm.\",\"voice_1\":\"Zephyr\"}}"), timeout=120)
response.raise_for_status()
print(response.text)
```

### HTTP · JavaScript

```js
import { randomUUID } from "node:crypto";
import { readFile } from "node:fs/promises";

const headers = Object.fromEntries(Object.entries({
  "Authorization": "Bearer $INVIDEO_API_KEY",
  "Content-Type": "application/json"
})
  .map(([name, value]) => [name, value.replace("$INVIDEO_API_KEY", process.env.INVIDEO_API_KEY)]));

const response = await fetch("https://platform-api.invideo.io/v1/request", {
  method: "POST", headers, body: JSON.stringify({"model":"gemini-3-1-flash-tts","mode":"generate","input":{"prompt":"The afternoon light is soft and warm.","voice_1":"Zephyr"}}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.text());
```

answers at once with the request's id; read it with GET /v1/request/{id} until it has ended. The completed request contains `output.files[]` with temporary download links, or `output.transcript` for transcription.

`cost_usd` on the completed request. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "status": "succeeded",
  "output": {
    "files": [
      {
        "url": "https://…/completed-output"
      }
    ]
  },
  "cost_usd": "0.024",
  "cost": {
    "total_usd": "0.024",
    "lines": [
      {
        "item": "request",
        "quantity": "1",
        "unit_price_usd": "0.024",
        "amount_usd": "0.024"
      }
    ]
  }
}
```

## Adobe Firefly

Set the base URL to `https://platform-api.invideo.io/adobe`. Use `Authorization: Bearer $INVIDEO_API_KEY` for authentication.

Endpoint `POST /adobe/v1/dub` · Model ID in `model`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/adobe/v1/dub' \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "model": "gemini-3-1-flash-tts",
    "extra": {
      "prompt": "The afternoon light is soft and warm.",
      "voice_1": "Zephyr"
    }
  }'
```

### HTTP · Python

```python
import json
import os
from pathlib import Path
from uuid import uuid4

import requests

headers = {name: value.replace("$INVIDEO_API_KEY", os.environ["INVIDEO_API_KEY"])
           for name, value in json.loads("{\"Authorization\":\"Bearer $INVIDEO_API_KEY\",\"Content-Type\":\"application/json\"}").items()}
response = requests.post("https://platform-api.invideo.io/adobe/v1/dub", headers=headers, json=json.loads("{\"model\":\"gemini-3-1-flash-tts\",\"extra\":{\"prompt\":\"The afternoon light is soft and warm.\",\"voice_1\":\"Zephyr\"}}"), timeout=120)
response.raise_for_status()
print(response.text)
```

### HTTP · JavaScript

```js
import { randomUUID } from "node:crypto";
import { readFile } from "node:fs/promises";

const headers = Object.fromEntries(Object.entries({
  "Authorization": "Bearer $INVIDEO_API_KEY",
  "Content-Type": "application/json"
})
  .map(([name, value]) => [name, value.replace("$INVIDEO_API_KEY", process.env.INVIDEO_API_KEY)]));

const response = await fetch("https://platform-api.invideo.io/adobe/v1/dub", {
  method: "POST", headers, body: JSON.stringify({"model":"gemini-3-1-flash-tts","extra":{"prompt":"The afternoon light is soft and warm.","voice_1":"Zephyr"}}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.text());
```

Returns a task. Read `GET /adobe/v1/status/{id}` for the result.

`metadata.invideo_cost_usd` on the completed result. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "metadata": {
    "invideo_cost_usd": "0.024",
    "invideo_cost": {
      "total_usd": "0.024",
      "lines": [
        {
          "item": "request",
          "quantity": "1",
          "unit_price_usd": "0.024",
          "amount_usd": "0.024"
        }
      ]
    }
  }
}
```

## BytePlus ModelArk

Set the base URL to `https://platform-api.invideo.io/byteplus`. Use `Authorization: Bearer $INVIDEO_API_KEY` for authentication.

Endpoint `POST /byteplus/api/v3/tts/create` · Model ID in `model`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/byteplus/api/v3/tts/create' \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "model": "gemini-3-1-flash-tts",
    "extra": {
      "prompt": "The afternoon light is soft and warm.",
      "voice_1": "Zephyr"
    }
  }'
```

### HTTP · Python

```python
import json
import os
from pathlib import Path
from uuid import uuid4

import requests

headers = {name: value.replace("$INVIDEO_API_KEY", os.environ["INVIDEO_API_KEY"])
           for name, value in json.loads("{\"Authorization\":\"Bearer $INVIDEO_API_KEY\",\"Content-Type\":\"application/json\"}").items()}
response = requests.post("https://platform-api.invideo.io/byteplus/api/v3/tts/create", headers=headers, json=json.loads("{\"model\":\"gemini-3-1-flash-tts\",\"extra\":{\"prompt\":\"The afternoon light is soft and warm.\",\"voice_1\":\"Zephyr\"}}"), timeout=120)
response.raise_for_status()
print(response.text)
```

### HTTP · JavaScript

```js
import { randomUUID } from "node:crypto";
import { readFile } from "node:fs/promises";

const headers = Object.fromEntries(Object.entries({
  "Authorization": "Bearer $INVIDEO_API_KEY",
  "Content-Type": "application/json"
})
  .map(([name, value]) => [name, value.replace("$INVIDEO_API_KEY", process.env.INVIDEO_API_KEY)]));

const response = await fetch("https://platform-api.invideo.io/byteplus/api/v3/tts/create", {
  method: "POST", headers, body: JSON.stringify({"model":"gemini-3-1-flash-tts","extra":{"prompt":"The afternoon light is soft and warm.","voice_1":"Zephyr"}}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.text());
```

Returns the completed audio in the provider's response format.

`usage.invideo_cost_usd` on the result. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "usage": {
    "invideo_cost_usd": "0.024",
    "invideo_cost": {
      "total_usd": "0.024",
      "lines": [
        {
          "item": "request",
          "quantity": "1",
          "unit_price_usd": "0.024",
          "amount_usd": "0.024"
        }
      ]
    }
  }
}
```

## Cartesia

Set the base URL to `https://platform-api.invideo.io/cartesia`. Use `Authorization: Bearer $INVIDEO_API_KEY` for authentication.

Endpoint `POST /cartesia/tts/bytes` · Model ID in `model_id`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/cartesia/tts/bytes' \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "model_id": "gemini-3-1-flash-tts",
    "extra": {
      "prompt": "The afternoon light is soft and warm.",
      "voice_1": "Zephyr"
    }
  }'
```

### Cartesia SDK · Python

```python
import json
import os
from pathlib import Path
import httpx
from cartesia import Cartesia

client = Cartesia(base_url="https://platform-api.invideo.io/cartesia", api_key=os.environ["INVIDEO_API_KEY"])
result = client.post("/tts/bytes", cast_to=httpx.Response, body=json.loads("{\"model_id\":\"gemini-3-1-flash-tts\",\"extra\":{\"prompt\":\"The afternoon light is soft and warm.\",\"voice_1\":\"Zephyr\"}}"))
if result.headers.get("content-type", "").startswith("audio/"):
    Path("output.audio").write_bytes(result.content)
else:
    print(result.json())
print(result.headers.get("x-invideo-cost-usd"))
```

### HTTP · JavaScript

```js
import { randomUUID } from "node:crypto";
import { readFile } from "node:fs/promises";

const headers = Object.fromEntries(Object.entries({
  "Authorization": "Bearer $INVIDEO_API_KEY",
  "Content-Type": "application/json"
})
  .map(([name, value]) => [name, value.replace("$INVIDEO_API_KEY", process.env.INVIDEO_API_KEY)]));

const response = await fetch("https://platform-api.invideo.io/cartesia/tts/bytes", {
  method: "POST", headers, body: JSON.stringify({"model_id":"gemini-3-1-flash-tts","extra":{"prompt":"The afternoon light is soft and warm.","voice_1":"Zephyr"}}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.text());
```

Returns the completed audio in the provider's response format.

The audio response is bytes. Read the USD charge from `x-invideo-cost-usd`. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "x-invideo-cost-usd": "0.024",
  "x-invideo-cost-breakdown": {
    "total_usd": "0.024",
    "lines": [
      {
        "item": "request",
        "quantity": "1",
        "unit_price_usd": "0.024",
        "amount_usd": "0.024"
      }
    ]
  }
}
```

## Cleanvoice

Set the base URL to `https://platform-api.invideo.io/cleanvoice`. Use `Authorization: Bearer $INVIDEO_API_KEY` for authentication.

Endpoint `POST /cleanvoice/v2/edits` · Model ID in `model`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/cleanvoice/v2/edits' \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "model": "gemini-3-1-flash-tts",
    "extra": {
      "prompt": "The afternoon light is soft and warm.",
      "voice_1": "Zephyr"
    }
  }'
```

### HTTP · Python

```python
import json
import os
from pathlib import Path
from uuid import uuid4

import requests

headers = {name: value.replace("$INVIDEO_API_KEY", os.environ["INVIDEO_API_KEY"])
           for name, value in json.loads("{\"Authorization\":\"Bearer $INVIDEO_API_KEY\",\"Content-Type\":\"application/json\"}").items()}
response = requests.post("https://platform-api.invideo.io/cleanvoice/v2/edits", headers=headers, json=json.loads("{\"model\":\"gemini-3-1-flash-tts\",\"extra\":{\"prompt\":\"The afternoon light is soft and warm.\",\"voice_1\":\"Zephyr\"}}"), timeout=120)
response.raise_for_status()
print(response.text)
```

### HTTP · JavaScript

```js
import { randomUUID } from "node:crypto";
import { readFile } from "node:fs/promises";

const headers = Object.fromEntries(Object.entries({
  "Authorization": "Bearer $INVIDEO_API_KEY",
  "Content-Type": "application/json"
})
  .map(([name, value]) => [name, value.replace("$INVIDEO_API_KEY", process.env.INVIDEO_API_KEY)]));

const response = await fetch("https://platform-api.invideo.io/cleanvoice/v2/edits", {
  method: "POST", headers, body: JSON.stringify({"model":"gemini-3-1-flash-tts","extra":{"prompt":"The afternoon light is soft and warm.","voice_1":"Zephyr"}}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.text());
```

Returns a task. Read `GET /cleanvoice/v2/edits/{id}` for the result.

`metadata.invideo_cost_usd` on the completed result. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "metadata": {
    "invideo_cost_usd": "0.024",
    "invideo_cost": {
      "total_usd": "0.024",
      "lines": [
        {
          "item": "request",
          "quantity": "1",
          "unit_price_usd": "0.024",
          "amount_usd": "0.024"
        }
      ]
    }
  }
}
```

## ElevenLabs

Set the base URL to `https://platform-api.invideo.io/elevenlabs`. Use `xi-api-key: $INVIDEO_API_KEY` for authentication.

Endpoint `POST /elevenlabs/v1/text-to-speech/Zephyr` · Model ID in `model_id`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/elevenlabs/v1/text-to-speech/Zephyr' \
  -H "xi-api-key: $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "text": "The afternoon light is soft and warm.",
    "model_id": "gemini-3-1-flash-tts"
  }'
```

### ElevenLabs SDK · Python

```python
import os
from elevenlabs.client import ElevenLabs

client = ElevenLabs(api_key=os.environ["INVIDEO_API_KEY"], base_url="https://platform-api.invideo.io/elevenlabs")
audio = client.text_to_speech.convert("Zephyr", text="The afternoon light is soft and warm.", model_id="gemini-3-1-flash-tts")
open("speech.mp3", "wb").write(b"".join(audio))
```

### ElevenLabs SDK · JavaScript

```js
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";

const client = new ElevenLabsClient({ apiKey: process.env.INVIDEO_API_KEY, baseUrl: "https://platform-api.invideo.io/elevenlabs" });
const audio = await client.textToSpeech.convert("Zephyr", { text: "The afternoon light is soft and warm.", modelId: "gemini-3-1-flash-tts" });
```

the audio bytes, when the run ends.

The audio response is bytes. Read the USD charge from `x-invideo-cost-usd`. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "x-invideo-cost-usd": "0.024",
  "x-invideo-cost-breakdown": {
    "total_usd": "0.024",
    "lines": [
      {
        "item": "request",
        "quantity": "1",
        "unit_price_usd": "0.024",
        "amount_usd": "0.024"
      }
    ]
  }
}
```

## fal

Set the base URL to `https://platform-api.invideo.io/fal`. Use `Authorization: Key $INVIDEO_API_KEY` for authentication.

Endpoint `POST /fal/gemini-3-1-flash-tts` · Model ID in `URL model segment`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/fal/gemini-3-1-flash-tts' \
  -H "Authorization: Key $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "prompt": "The afternoon light is soft and warm.",
    "voice_1": "Zephyr"
  }'
```

### fal · JavaScript

```js
const response = await fetch("https://platform-api.invideo.io/fal/gemini-3-1-flash-tts", {
  method: "POST",
  redirect: "error",
  headers: {
    Authorization: `Key ${process.env.INVIDEO_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "prompt": "The afternoon light is soft and warm.",
  "voice_1": "Zephyr"
}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
```

### HTTP · Python

```python
import json
import os
from pathlib import Path
from uuid import uuid4

import requests

headers = {name: value.replace("$INVIDEO_API_KEY", os.environ["INVIDEO_API_KEY"])
           for name, value in json.loads("{\"Authorization\":\"Key $INVIDEO_API_KEY\",\"Content-Type\":\"application/json\"}").items()}
response = requests.post("https://platform-api.invideo.io/fal/gemini-3-1-flash-tts", headers=headers, json=json.loads("{\"prompt\":\"The afternoon light is soft and warm.\",\"voice_1\":\"Zephyr\"}"), timeout=120)
response.raise_for_status()
print(response.text)
```

a queue request: read status_url until COMPLETED, then response_url for the result.

`usage.cost` on the completed result. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "usage": {
    "cost": "0.024",
    "invideo_cost": {
      "total_usd": "0.024",
      "lines": [
        {
          "item": "request",
          "quantity": "1",
          "unit_price_usd": "0.024",
          "amount_usd": "0.024"
        }
      ]
    }
  }
}
```

## Fish Audio

Set the base URL to `https://platform-api.invideo.io/fishaudio`. Use `Authorization: Bearer $INVIDEO_API_KEY` for authentication.

Endpoint `POST /fishaudio/v1/tts` · Model ID in `Model header`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/fishaudio/v1/tts' \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  -H 'model: gemini-3-1-flash-tts' \
  --data-binary '{
    "extra": {
      "prompt": "The afternoon light is soft and warm.",
      "voice_1": "Zephyr"
    }
  }'
```

### HTTP · Python

```python
import json
import os
from pathlib import Path
from uuid import uuid4

import requests

headers = {name: value.replace("$INVIDEO_API_KEY", os.environ["INVIDEO_API_KEY"])
           for name, value in json.loads("{\"Authorization\":\"Bearer $INVIDEO_API_KEY\",\"Content-Type\":\"application/json\",\"model\":\"gemini-3-1-flash-tts\"}").items()}
response = requests.post("https://platform-api.invideo.io/fishaudio/v1/tts", headers=headers, json=json.loads("{\"extra\":{\"prompt\":\"The afternoon light is soft and warm.\",\"voice_1\":\"Zephyr\"}}"), timeout=120)
response.raise_for_status()
print(response.text)
```

### HTTP · JavaScript

```js
import { randomUUID } from "node:crypto";
import { readFile } from "node:fs/promises";

const headers = Object.fromEntries(Object.entries({
  "Authorization": "Bearer $INVIDEO_API_KEY",
  "Content-Type": "application/json",
  "model": "gemini-3-1-flash-tts"
})
  .map(([name, value]) => [name, value.replace("$INVIDEO_API_KEY", process.env.INVIDEO_API_KEY)]));

const response = await fetch("https://platform-api.invideo.io/fishaudio/v1/tts", {
  method: "POST", headers, body: JSON.stringify({"extra":{"prompt":"The afternoon light is soft and warm.","voice_1":"Zephyr"}}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.text());
```

Returns the completed audio in the provider's response format.

The audio response is bytes. Read the USD charge from `x-invideo-cost-usd`. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "x-invideo-cost-usd": "0.024",
  "x-invideo-cost-breakdown": {
    "total_usd": "0.024",
    "lines": [
      {
        "item": "request",
        "quantity": "1",
        "unit_price_usd": "0.024",
        "amount_usd": "0.024"
      }
    ]
  }
}
```

## Gemini

Set the base URL to `https://platform-api.invideo.io`. Use `x-goog-api-key: $INVIDEO_API_KEY` for authentication.

Endpoint `POST /v1beta/models/gemini-3-1-flash-tts:generateContent` · Model ID in `URL model segment`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/v1beta/models/gemini-3-1-flash-tts:generateContent' \
  -H "x-goog-api-key: $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "contents": [
      {
        "parts": [
          {
            "text": "The afternoon light is soft and warm."
          }
        ]
      }
    ],
    "generationConfig": {
      "responseModalities": [
        "AUDIO"
      ]
    },
    "extra": {
      "voice_1": "Zephyr"
    }
  }'
```

### HTTP · Python

```python
import json
import os
from pathlib import Path
from uuid import uuid4

import requests

headers = {name: value.replace("$INVIDEO_API_KEY", os.environ["INVIDEO_API_KEY"])
           for name, value in json.loads("{\"x-goog-api-key\":\"$INVIDEO_API_KEY\",\"Content-Type\":\"application/json\"}").items()}
response = requests.post("https://platform-api.invideo.io/v1beta/models/gemini-3-1-flash-tts:generateContent", headers=headers, json=json.loads("{\"contents\":[{\"parts\":[{\"text\":\"The afternoon light is soft and warm.\"}]}],\"generationConfig\":{\"responseModalities\":[\"AUDIO\"]},\"extra\":{\"voice_1\":\"Zephyr\"}}"), timeout=120)
response.raise_for_status()
print(response.text)
```

### HTTP · JavaScript

```js
import { randomUUID } from "node:crypto";
import { readFile } from "node:fs/promises";

const headers = Object.fromEntries(Object.entries({
  "x-goog-api-key": "$INVIDEO_API_KEY",
  "Content-Type": "application/json"
})
  .map(([name, value]) => [name, value.replace("$INVIDEO_API_KEY", process.env.INVIDEO_API_KEY)]));

const response = await fetch("https://platform-api.invideo.io/v1beta/models/gemini-3-1-flash-tts:generateContent", {
  method: "POST", headers, body: JSON.stringify({"contents":[{"parts":[{"text":"The afternoon light is soft and warm."}]}],"generationConfig":{"responseModalities":["AUDIO"]},"extra":{"voice_1":"Zephyr"}}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.text());
```

The audio bytes are in `candidates[0].content.parts[0].inlineData`. Read media bytes and the MIME type in `candidates[0].content.parts[].inlineData`.

`usageMetadata.cost_usd` on the completed result. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "usageMetadata": {
    "cost_usd": "0.024",
    "invideo_cost": {
      "total_usd": "0.024",
      "lines": [
        {
          "item": "request",
          "quantity": "1",
          "unit_price_usd": "0.024",
          "amount_usd": "0.024"
        }
      ]
    }
  }
}
```

## MiniMax

Set the base URL to `https://platform-api.invideo.io/minimax`. Use `Authorization: Bearer $INVIDEO_API_KEY` for authentication.

Endpoint `POST /minimax/v1/music_generation` · Model ID in `model`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/minimax/v1/music_generation' \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "model": "gemini-3-1-flash-tts",
    "output_format": "url",
    "extra": {
      "prompt": "The afternoon light is soft and warm.",
      "voice_1": "Zephyr"
    }
  }'
```

### HTTP · Python

```python
import json
import os
from pathlib import Path
from uuid import uuid4

import requests

headers = {name: value.replace("$INVIDEO_API_KEY", os.environ["INVIDEO_API_KEY"])
           for name, value in json.loads("{\"Authorization\":\"Bearer $INVIDEO_API_KEY\",\"Content-Type\":\"application/json\"}").items()}
response = requests.post("https://platform-api.invideo.io/minimax/v1/music_generation", headers=headers, json=json.loads("{\"model\":\"gemini-3-1-flash-tts\",\"output_format\":\"url\",\"extra\":{\"prompt\":\"The afternoon light is soft and warm.\",\"voice_1\":\"Zephyr\"}}"), timeout=120)
response.raise_for_status()
print(response.text)
```

### HTTP · JavaScript

```js
import { randomUUID } from "node:crypto";
import { readFile } from "node:fs/promises";

const headers = Object.fromEntries(Object.entries({
  "Authorization": "Bearer $INVIDEO_API_KEY",
  "Content-Type": "application/json"
})
  .map(([name, value]) => [name, value.replace("$INVIDEO_API_KEY", process.env.INVIDEO_API_KEY)]));

const response = await fetch("https://platform-api.invideo.io/minimax/v1/music_generation", {
  method: "POST", headers, body: JSON.stringify({"model":"gemini-3-1-flash-tts","output_format":"url","extra":{"prompt":"The afternoon light is soft and warm.","voice_1":"Zephyr"}}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.text());
```

Returns the completed audio in the provider's response format.

`extra_info.invideo_cost_usd` on the result. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "extra_info": {
    "invideo_cost_usd": "0.024",
    "invideo_cost": {
      "total_usd": "0.024",
      "lines": [
        {
          "item": "request",
          "quantity": "1",
          "unit_price_usd": "0.024",
          "amount_usd": "0.024"
        }
      ]
    }
  }
}
```

## Mureka

Set the base URL to `https://platform-api.invideo.io/mureka`. Use `Authorization: Bearer $INVIDEO_API_KEY` for authentication.

Endpoint `POST /mureka/v1/song/generate` · Model ID in `model`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/mureka/v1/song/generate' \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "model": "gemini-3-1-flash-tts",
    "extra": {
      "prompt": "The afternoon light is soft and warm.",
      "voice_1": "Zephyr"
    }
  }'
```

### HTTP · Python

```python
import json
import os
from pathlib import Path
from uuid import uuid4

import requests

headers = {name: value.replace("$INVIDEO_API_KEY", os.environ["INVIDEO_API_KEY"])
           for name, value in json.loads("{\"Authorization\":\"Bearer $INVIDEO_API_KEY\",\"Content-Type\":\"application/json\"}").items()}
response = requests.post("https://platform-api.invideo.io/mureka/v1/song/generate", headers=headers, json=json.loads("{\"model\":\"gemini-3-1-flash-tts\",\"extra\":{\"prompt\":\"The afternoon light is soft and warm.\",\"voice_1\":\"Zephyr\"}}"), timeout=120)
response.raise_for_status()
print(response.text)
```

### HTTP · JavaScript

```js
import { randomUUID } from "node:crypto";
import { readFile } from "node:fs/promises";

const headers = Object.fromEntries(Object.entries({
  "Authorization": "Bearer $INVIDEO_API_KEY",
  "Content-Type": "application/json"
})
  .map(([name, value]) => [name, value.replace("$INVIDEO_API_KEY", process.env.INVIDEO_API_KEY)]));

const response = await fetch("https://platform-api.invideo.io/mureka/v1/song/generate", {
  method: "POST", headers, body: JSON.stringify({"model":"gemini-3-1-flash-tts","extra":{"prompt":"The afternoon light is soft and warm.","voice_1":"Zephyr"}}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.text());
```

Returns a task. Read `GET /mureka/v1/song/query/{id}` for the result.

`usage.invideo_cost_usd` on the result. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "usage": {
    "invideo_cost_usd": "0.024",
    "invideo_cost": {
      "total_usd": "0.024",
      "lines": [
        {
          "item": "request",
          "quantity": "1",
          "unit_price_usd": "0.024",
          "amount_usd": "0.024"
        }
      ]
    }
  }
}
```

## OpenAI

Set the base URL to `https://platform-api.invideo.io/v1`. Use `Authorization: Bearer $INVIDEO_API_KEY` for authentication.

Endpoint `POST /v1/audio/speech` · Model ID in `model`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/v1/audio/speech' \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "model": "gemini-3-1-flash-tts",
    "voice": "Zephyr",
    "input": "The afternoon light is soft and warm."
  }'
```

### OpenAI SDK · Python

```python
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["INVIDEO_API_KEY"], base_url="https://platform-api.invideo.io/v1")
speech = client.audio.speech.create(model="gemini-3-1-flash-tts", voice="Zephyr", input="The afternoon light is soft and warm.")
speech.write_to_file("speech.mp3")
```

### OpenAI SDK · JavaScript

```js
import OpenAI from "openai";
import { writeFile } from "node:fs/promises";

const client = new OpenAI({ apiKey: process.env.INVIDEO_API_KEY, baseURL: "https://platform-api.invideo.io/v1" });
const speech = await client.audio.speech.create({ model: "gemini-3-1-flash-tts", voice: "Zephyr", input: "The afternoon light is soft and warm." });
await writeFile("speech.mp3", Buffer.from(await speech.arrayBuffer()));
```

the audio bytes, when the run ends (the `Content-Type` header says the format).

The audio response is bytes. Read the USD charge from `x-invideo-cost-usd`. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "x-invideo-cost-usd": "0.024",
  "x-invideo-cost-breakdown": {
    "total_usd": "0.024",
    "lines": [
      {
        "item": "request",
        "quantity": "1",
        "unit_price_usd": "0.024",
        "amount_usd": "0.024"
      }
    ]
  }
}
```

## Replicate

Set the base URL to `https://platform-api.invideo.io/replicate`. Use `Authorization: Bearer $INVIDEO_API_KEY` for authentication.

Endpoint `POST /replicate/v1/models/invideo/gemini-3-1-flash-tts/predictions` · Model ID in `URL model segment`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/replicate/v1/models/invideo/gemini-3-1-flash-tts/predictions' \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "input": {
      "prompt": "The afternoon light is soft and warm.",
      "voice_1": "Zephyr"
    }
  }'
```

### Replicate client · Python

```python
import os, replicate

client = replicate.Client(api_token=os.environ["INVIDEO_API_KEY"], base_url="https://platform-api.invideo.io/replicate")
output = client.run("invideo/gemini-3-1-flash-tts", input={
    "prompt": "The afternoon light is soft and warm.",
    "voice_1": "Zephyr",
})
print(output)
```

### Replicate client · JavaScript

```js
import Replicate from "replicate";

const replicate = new Replicate({ auth: process.env.INVIDEO_API_KEY, baseUrl: "https://platform-api.invideo.io/replicate/v1" });
const output = await replicate.run("invideo/gemini-3-1-flash-tts", { input: {
  "prompt": "The afternoon light is soft and warm.",
  "voice_1": "Zephyr"
} });
console.log(output);
```

a prediction: read it with GET /replicate/v1/predictions/{id} until the run ends. Read `output` from the completed prediction. It holds a download URL or a list of URLs.

`metrics.cost_usd` on the completed prediction. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "status": "succeeded",
  "output": [
    "https://…/completed-output"
  ],
  "metrics": {
    "cost_usd": "0.024",
    "invideo_cost": {
      "total_usd": "0.024",
      "lines": [
        {
          "item": "request",
          "quantity": "1",
          "unit_price_usd": "0.024",
          "amount_usd": "0.024"
        }
      ]
    }
  }
}
```

## Sarvam

Set the base URL to `https://platform-api.invideo.io/sarvam`. Use `Authorization: Bearer $INVIDEO_API_KEY` for authentication.

Endpoint `POST /sarvam/text-to-speech` · Model ID in `model`.

### curl

```bash
curl -X POST 'https://platform-api.invideo.io/sarvam/text-to-speech' \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary '{
    "model": "gemini-3-1-flash-tts",
    "extra": {
      "prompt": "The afternoon light is soft and warm.",
      "voice_1": "Zephyr"
    }
  }'
```

### HTTP · Python

```python
import json
import os
from pathlib import Path
from uuid import uuid4

import requests

headers = {name: value.replace("$INVIDEO_API_KEY", os.environ["INVIDEO_API_KEY"])
           for name, value in json.loads("{\"Authorization\":\"Bearer $INVIDEO_API_KEY\",\"Content-Type\":\"application/json\"}").items()}
response = requests.post("https://platform-api.invideo.io/sarvam/text-to-speech", headers=headers, json=json.loads("{\"model\":\"gemini-3-1-flash-tts\",\"extra\":{\"prompt\":\"The afternoon light is soft and warm.\",\"voice_1\":\"Zephyr\"}}"), timeout=120)
response.raise_for_status()
print(response.text)
```

### HTTP · JavaScript

```js
import { randomUUID } from "node:crypto";
import { readFile } from "node:fs/promises";

const headers = Object.fromEntries(Object.entries({
  "Authorization": "Bearer $INVIDEO_API_KEY",
  "Content-Type": "application/json"
})
  .map(([name, value]) => [name, value.replace("$INVIDEO_API_KEY", process.env.INVIDEO_API_KEY)]));

const response = await fetch("https://platform-api.invideo.io/sarvam/text-to-speech", {
  method: "POST", headers, body: JSON.stringify({"model":"gemini-3-1-flash-tts","extra":{"prompt":"The afternoon light is soft and warm.","voice_1":"Zephyr"}}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.text());
```

Returns the completed audio in the provider's response format. The `audios[]` list contains base64-encoded audio.

`metadata.invideo_cost_usd` on the completed result. The settled USD charge is also in `x-invideo-cost-usd` when known before headers are sent.

### Example response fields

```json
{
  "metadata": {
    "invideo_cost_usd": "0.024",
    "invideo_cost": {
      "total_usd": "0.024",
      "lines": [
        {
          "item": "request",
          "quantity": "1",
          "unit_price_usd": "0.024",
          "amount_usd": "0.024"
        }
      ]
    }
  }
}
```

## invideo API input

The keys of `input`. An unknown key is refused. A file is an `https` URL or a data URI. Inline (data URI) up to 64 MB per request; larger files: an `https` URL or an upload, video up to 300 MB.

| Key | Type | Required | Default | Allowed | Description |
| --- | --- | --- | --- | --- | --- |
| `prompt` | string | yes | - | up to 50,000 characters | Prompt |
| `voice_1` | string | yes | - | `"Zephyr"`, `"Puck"`, `"Charon"`, `"Kore"`, `"Fenrir"`, `"Leda"`, `"Orus"`, `"Aoede"`, `"Callirrhoe"`, `"Autonoe"`, `"Enceladus"`, `"Iapetus"`, `"Umbriel"`, `"Algieba"`, `"Despina"`, `"Erinome"`, `"Algenib"`, `"Rasalgethi"`, `"Laomedeia"`, `"Achernar"`, `"Alnilam"`, `"Schedar"`, `"Gacrux"`, `"Pulcherrima"`, `"Achird"`, `"Zubenelgenubi"`, `"Vindemiatrix"`, `"Sadachbia"`, `"Sadaltager"`, `"Sulafat"` | Voice |
| `speaker_1` | string | no | - | up to 100 characters | Speaker name |
| `voice_2` | string | no | - | `"Zephyr"`, `"Puck"`, `"Charon"`, `"Kore"`, `"Fenrir"`, `"Leda"`, `"Orus"`, `"Aoede"`, `"Callirrhoe"`, `"Autonoe"`, `"Enceladus"`, `"Iapetus"`, `"Umbriel"`, `"Algieba"`, `"Despina"`, `"Erinome"`, `"Algenib"`, `"Rasalgethi"`, `"Laomedeia"`, `"Achernar"`, `"Alnilam"`, `"Schedar"`, `"Gacrux"`, `"Pulcherrima"`, `"Achird"`, `"Zubenelgenubi"`, `"Vindemiatrix"`, `"Sadachbia"`, `"Sadaltager"`, `"Sulafat"` | Second voice |
| `speaker_2` | string | no | - | up to 100 characters | Second speaker name |

## Output

### Submit answers

```json
{
  "id": "0f8b6c1e-0000-0000-0000-000000000000",
  "status": "queued"
}
```

### A finished request

```json
{
  "id": "0f8b6c1e-0000-0000-0000-000000000000",
  "model": "gemini-3-1-flash-tts",
  "mode": "generate",
  "status": "succeeded",
  "created_at": "2026-01-01T10:00:00Z",
  "started_at": "2026-01-01T10:00:02Z",
  "finished_at": "2026-01-01T10:01:00Z",
  "output": {
    "kind": "audio",
    "files": [
      {
        "url": "https://… (valid for 1 hour)",
        "content_type": "audio/mpeg",
        "size_bytes": 1048576,
        "width": null,
        "height": null,
        "duration": 5
      }
    ]
  },
  "error": null,
  "cost_usd": "0.25"
}
```

`status` is `preparing`, `queued`, `running`, `succeeded`, or `failed` (a request that did not start within 15 minutes fails with `queue_timeout`). `output` and `cost_usd` are `null` until it succeeds. Each file link is signed again on every read and works for 1 hour. A failed run is still a `200`: `error` holds `{type, code, message, retryable}`, and `type` is `content`, `model`, `input` or `server`.

## Request and response logs

Request and response logs, as JSON; files are fresh 1-hour links. `GET https://platform-api.invideo.io/v1/request/{id}/logs/request` gives what was sent, `GET https://platform-api.invideo.io/v1/request/{id}/logs/response` what came back. The key reads only its own workspace's requests. A log that is no longer available answers `410 log_expired`. `GET https://platform-api.invideo.io/v1/request/{id}` gives the log links without checking them.

### Read the response log (curl)

```bash
curl "https://platform-api.invideo.io/v1/request/$ID/logs/response" \
  -H "Authorization: Bearer $INVIDEO_API_KEY"
```

### A response log

```json
{
  "id": "01a21889-e91b-7aba-a0d6-7b2cc4510be7",
  "model": "<model-id>",
  "mode": "generate",
  "created_at": "2026-11-26T15:47:01.022556Z",
  "finished_at": "2026-11-26T15:47:09.350578Z",
  "cost_usd": "0.193248",
  "error": null,
  "output": {
    "files": [
      {
        "name": "1.mp3",
        "url": "https://…/1.mp3?X-Amz-Expires=3600&…",
        "download_url": "https://…/1.mp3?response-content-disposition=attachment…",
        "content_type": "audio/mpeg",
        "size_bytes": 1440620,
        "duration": 60.024,
        "width": null,
        "height": null
      }
    ]
  }
}
```

## Errors

A refused call answers with `{error}`, most with a `message` too; `invalid_input` has `detail` instead.

| HTTP | error | When |
| --- | --- | --- |
| 400 | - | The body is not valid JSON. |
| 401 | `unauthorized` | The API key is missing, invalid, disabled or expired. |
| 404 | `model_not_found` | No such model or mode, or it is not on for this workspace. |
| 404 | `not_found` | No request with this id (on a read). |
| 413 | - | The body is over 64 MB. Send larger files as an `https` URL or an upload. |
| 422 | `invalid_input` | `detail` lists each problem as `{loc, msg, type}`; `loc` ends with the field's name. |
| 422 | `model_not_priced` | These options have no price yet, so they cannot run. |
| 429 | `rate_limited` | Over the workspace's requests per minute (all its keys and the playground together; 300 by default, see Limits) or 3000 reads a minute. Wait `Retry-After` seconds. |
| 429 | `spend_limit_exceeded` | The spend limit of the workspace is used up. |
| 500 | `server_error` | Something went wrong on our end. Please try again. |

## Price

From $0.0005 / second.

| Mode and options | Unit rate (USD) |
| --- | --- |
| Generate | $0.000048 / character (typical) |
| Generate | $0.0005 / second |
