生产 API 统一走异步任务。

外部 API key 使用可恢复的上传、任务创建、状态查询和 webhook 回调。短音频实时路径属于内部产品能力,不在公开 token API 中开放。

快速开始

先在 console 创建 API key(ahk_ 开头)。外部集成按上传、完成上传、创建任务这三步异步流程处理。

长音频三步异步工作流

1. POST /v1/audio/uploads

curl https://audio.niumedia-ai.com/v1/audio/uploads \
  -H "Authorization: Bearer $ORPHEUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file_name":"meeting.mp3","mime_type":"audio/mpeg","size_bytes":52428800}'

2. PUT $UPLOAD_URL

curl $UPLOAD_URL \
  -X PUT \
  -H "Content-Type: audio/mpeg" \
  --data-binary @meeting.mp3

3. POST /v1/audio/jobs

# Complete the upload session, then create the job.
curl https://audio.niumedia-ai.com/v1/audio/uploads/$UPLOAD_ID/complete \
  -H "Authorization: Bearer $ORPHEUS_KEY" \
  -X POST

curl https://audio.niumedia-ai.com/v1/audio/jobs \
  -H "Authorization: Bearer $ORPHEUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"upload_id":"$UPLOAD_ID","task":"transcribe","callback_url":"https://your-app.com/webhook"}'

端点总览

公开 API 只暴露 async 合同。console workbench 的短音频快速路径在产品内部处理,不作为公开 API 文档或 token 能力开放。

EndpointPurposeLimit
POST /v1/audio/ingestCreate an async upload sessionBest effort
POST /v1/audio/uploadsCreate upload sessionUp to 2 GB
GET /v1/audio/uploads/:idRecover or inspect upload state
POST /v1/audio/uploads/:id/completeFinalize upload sessionIdempotent
POST /v1/audio/jobsCreate async transcription jobCompleted upload required
GET /v1/audio/jobs/:idPoll job status or fetch result

Webhook 回调

创建任务时传 callback_url。任务到终态后 Orpheus 发送一次签名 POST;非 2xx 最多重试 3 次。

  • Header: X-Orpheus-Signature
  • Format: t=<unix_seconds>,v1=<hmac_sha256_hex>
  • Signed payload: <timestamp>.<raw_body>
  • Replay window: reject timestamps older than 5 minutes
import crypto from 'node:crypto'

export function verify(rawBody: string, sigHeader: string, secret: string) {
  const parts = Object.fromEntries(sigHeader.split(',').map((p) => p.split('=', 2)))
  const timestamp = parseInt(parts.t, 10)
  if (Math.abs(Date.now() / 1000 - timestamp) > 300) throw new Error('timestamp too old')
  const expected = crypto.createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex')
  if (!crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1))) throw new Error('bad signature')
}

错误码

StatusCodeMeaning
400invalid_requestMissing or invalid request field
401unauthorizedAPI key missing or invalid
402insufficient_creditsWorkspace has no available quota
403plan_requiredPlan does not include API access
413file_too_largeUpload exceeds the supported object limit
415unsupported_media_typeAudio/video format is not supported
429rate_limit_exceededRetry after the returned Retry-After value
500 / 502internal_errorInclude x-orpheus-request-id when contacting support

限流

每个 API key 有独立 RPM 限额。超限返回 429,并带 Retry-After header。

获取 API key

登录 console,升级到 API 可用方案后创建 ahk_ 开头的密钥。

获取 API 密钥

查看价格

按方案获得额度、并发和 API 能力。

价格方案