Перейти к основному содержимому

АПИ транскрипции

Эндпоинты защищены HMAC‑аутентификацией (см. Аутентификация). Все пути ниже начинаются с /v1.

Общий поток

  1. (Опционально) Рассчитать стоимость: POST /transcriptions/calculate (См. документацию)
  2. Создать транскрипцию и поставить задание в очередь: POST /transcriptions (См. документацию).
  3. (Опционально) Для получения списка доступных моделей для анализа вызвать метод GET /ai/models (См. документацию).
  4. Проверять статус и забирать ссылки на результаты: GET /transcriptions/{id} где {id} - идентификатор транскрипции (См. документацию).

Примеры

Все защищённые запросы требуют заголовков X-Public-Key, X-Timestamp, X-Signature.

1) Рассчитать стоимость — POST /v1/transcriptions/calculate

См. OpenAPI

TS=$(date +%s)
BODY='{"priority":"queue","duration":"00:05"}'
SIG=$(printf "%s\n%s" "$API_PUBLIC" "$TS" | openssl dgst -sha256 -hmac "$API_SECRET" -hex | sed 's/^.* //')

curl -sS -X POST "https://api.transcription.aiesa.ru/api/v1/transcriptions/calculate" \
-H "Content-Type: application/json" \
-H "X-Public-Key: $API_PUBLIC" \
-H "X-Timestamp: $TS" \
-H "X-Signature: $SIG" \
-d "$BODY"

Пример ответа 200 (сокращено):

{
"durationSeconds": 120.5,
"durationMinutes": 2.01,
"minutesBilled": 3,
"cost": 0.05,
"balance": {
"balance": 15000.5,
"currency": "RUB",
"credit_limit": 50000,
"overdraft_enabled": true,
"overdraft_used": 0,
"available_credit": 65000.5,
"tariff_plan": "regional_plus",
"usage_current_month": {
"minutes_lightning": 1250,
"minutes_queue": 8500,
"total_cost": 3125.5
}
}
}

2) Создать транскрипцию — POST /v1/transcriptions

См. OpenAPI

  • Вариант А: загрузка файла (multipart/form-data, поле file)
TS=$(date +%s)
SIG=$(printf "%s\n%s" "$API_PUBLIC" "$TS" | openssl dgst -sha256 -hmac "$API_SECRET" -hex | sed 's/^.* //')

curl -sS -X POST "https://api.transcription.aiesa.ru/api/v1/transcriptions" \
-H "X-Public-Key: $API_PUBLIC" \
-H "X-Timestamp: $TS" \
-H "X-Signature: $SIG" \
-F "file=@/path/to/meeting_record.mp3" \
-F "language=ru" \
-F "priority=queue" \
-F "enable_diarization=true" \
-F "ai_prompt="
  • Вариант Б: загрузка по URL (source_url)
TS=$(date +%s)
SIG=$(printf "%s\n%s" "$API_PUBLIC" "$TS" | openssl dgst -sha256 -hmac "$API_SECRET" -hex | sed 's/^.* //')

curl -sS -X POST "https://api.transcription.aiesa.ru/api/v1/transcriptions" \
-H "X-Public-Key: $API_PUBLIC" \
-H "X-Timestamp: $TS" \
-H "X-Signature: $SIG" \
-F "source_type=url" \
-F "source_url=https://example.com/audio.mp3" \
-F "language=en" \
-F "priority=lightning" \
-F "enable_diarization=false"

Пример ответа 201 (сокращено):

{
"transcription_id": "2f0b2f2a-5b07-4c3e-8a42-5c8a3f2b1e9d",
"status": "pending",
"model": "base",
"language": "ru",
"priority_type": "queue",
"need_confirm": true,
"message": "Transcription created. File processing started in background."
}

3) Получить транскрипцию — GET /v1/transcriptions/{id}

См. OpenAPI

TS=$(date +%s)
SIG=$(printf "%s\n%s" "$API_PUBLIC" "$TS" | openssl dgst -sha256 -hmac "$API_SECRET" -hex | sed 's/^.* //')

curl -sS "https://api.transcription.aiesa.ru/api/v1/transcriptions/2f0b2f2a-5b07-4c3e-8a42-5c8a3f2b1e9d" \
-H "X-Public-Key: $API_PUBLIC" \
-H "X-Timestamp: $TS" \
-H "X-Signature: $SIG"

Пример ответа — статус «В процессе»:

{
"data": {
"id": "2f0b2f2a-5b07-4c3e-8a42-5c8a3f2b1e9d",
"status": "processing",
"progress": 65,
"duration_seconds": 125.5,
"duration_minutes": 2.09,
"minutes_billed": 3,
"priority_type": "queue",
"filename": "meeting_record.mp3",
"file_size": 15728640,
"source_type": "upload",
"model": "base",
"language": "ru",
"results": null,
"ai_analysis": null,
"error_message": null,
"created_at": "2025-10-29T11:22:33Z",
"started_at": "2025-10-29T11:23:01Z",
"completed_at": null,
"billed_at": null
}
}

Пример ответа — статус «Готово» (с результатами):

{
"data": {
"id": "2f0b2f2a-5b07-4c3e-8a42-5c8a3f2b1e9d",
"status": "completed",
"progress": 100,
"duration_seconds": 125.5,
"duration_minutes": 2.09,
"minutes_billed": 3,
"cost": 2.1,
"priority_type": "queue",
"filename": "meeting_record.mp3",
"file_size": 15728640,
"source_type": "upload",
"model": "base",
"language": "ru",
"results": {
"text": "https://cdn.aiesa.ru/transcriptions/2f0b2f2a/text.txt",
"json": "https://cdn.aiesa.ru/transcriptions/2f0b2f2a/result.json",
"pdf": "https://cdn.aiesa.ru/transcriptions/2f0b2f2a/report.pdf"
},
"ai_analysis": {
"model": "gpt-oss:20b",
"prompt": "Ключевые моменты разговора",
"text": "... краткое резюме ..."
},
"error_message": null,
"created_at": "2025-10-29T11:22:33Z",
"started_at": "2025-10-29T11:23:01Z",
"completed_at": "2025-10-29T11:24:15Z",
"billed_at": "2025-10-29T11:24:30Z"
}
}