К обзору модели

API-документация

Подробное подключение Task API для Gemini 3.1 Flash TTS

API-документация

Эндпоинт

Базовый URLhttps://api.mashagpt.ru/v1
Эндпоинт
POST
/v1/tasks/gemini-3-1-flash-tts
Авторизация
x-api-key: YOUR_API_KEY
илиAuthorization: Bearer YOUR_API_KEY

Параметры запроса

ПараметрТипОписание
speakers*
arrayOne or two speaker definitions. speakerId values must be unique. Пример — [{"speakerId":"Speaker 1","voiceName":"Zephyr","audioProfile":"A warm and confident documentary narrator","accent":"Neutral","style":"Deadpan","pace":"Natural"},{"speakerId":"Speaker 2","voiceName":"Puck","audioProfile":"An energetic and curious co-host","accent":"American (Gen)","style":"Vocal Smile","pace":"Natural"}].
dialogueTurns*
arrayOrdered dialogue turns. Every speakerId must reference a declared speaker. Пример — [{"speakerId":"Speaker 1","text":"[warmly] Welcome to the show."},{"speakerId":"Speaker 2","text":"[excited] Glad to be here!"}].
scene
stringGlobal scene and recording context used to guide the performance. Пример — Two hosts recording a relaxed technology podcast..
sampleContext
stringExample context that helps the model maintain tone and conversational continuity. Пример — Keep the exchange natural, concise, and friendly..
temperature
numberSampling temperature. Диапазон 0–2. По умолчанию — 1.

Пример запроса и ответа

Запрос
curl -X POST https://api.mashagpt.ru/v1/tasks/gemini-3-1-flash-tts \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "speakers": [
    {
      "speakerId": "Speaker 1",
      "voiceName": "Zephyr",
      "audioProfile": "A warm and confident documentary narrator",
      "accent": "Neutral",
      "style": "Deadpan",
      "pace": "Natural"
    },
    {
      "speakerId": "Speaker 2",
      "voiceName": "Puck",
      "audioProfile": "An energetic and curious co-host",
      "accent": "American (Gen)",
      "style": "Vocal Smile",
      "pace": "Natural"
    }
  ],
  "dialogueTurns": [
    {
      "speakerId": "Speaker 1",
      "text": "[warmly] Welcome to the show."
    },
    {
      "speakerId": "Speaker 2",
      "text": "[excited] Glad to be here!"
    }
  ],
  "temperature": 1
}'
Ответ
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "550e8400-e29b-41d4-a716-446655440000",
    "state": "queued"
  }
}

Асинхронная обработка

Модель работает асинхронно. После запроса вы получите taskId задачи для отслеживания статуса.

GET
/v1/tasks/{id}статус задачи
Проверка статуса задачи:
curl -X GET "https://api.mashagpt.ru/v1/tasks/{task_id}" \
  -H "x-api-key: YOUR_API_KEY"

Жизненный цикл задачи:

queuedprocessingcompleted|failed