跳转到内容

Create a bounded realtime session with a single-use connection ticket

POST
/t1/realtime/sessions
curl --request POST \
--url https://api.tansr.com/t1/realtime/sessions \
--header 'Content-Type: application/json' \
--header 'idempotency-key: example' \
--header 'x-tansr-app-token: <x-tansr-app-token>' \
--data '{ "model": "example", "operation": "transcribe", "input": { "codec": "pcm16", "sampleRate": 8000, "channels": 1 }, "targetLanguage": "example", "maxDurationSeconds": 1, "maxAmount": "example" }'

Available only for bindings with verified metering and native output bounds. Connect with the returned path using the same application credentials and ticket subprotocol. Idempotent replay recovers the task, never a consumed or lost ticket; it does not create another session.

idempotency-key
required
string
>= 16 characters <= 128 characters

Reuse the same key and original input after a transport interruption. An unknown outcome must not be retried with a new key.

Media typeapplication/json
object
model
string
>= 1 characters <= 128 characters
operation
required
Any of:
string
Allowed value: transcribe
input
required
object
codec
required
string
Allowed value: pcm16
sampleRate
required
Any of:
number
Allowed value: 8000
channels
required
number
Allowed value: 1
targetLanguage
string
>= 2 characters <= 32 characters
maxDurationSeconds
required
integer
>= 1 <= 600
maxAmount
string
/^(?:0|[1-9][0-9]*)(?:\.[0-9]{1,6})?$/

Application-private operation receipt; result may expire independently of billing and idempotency.

Media typeapplication/json
object
protocol
required
string
Allowed value: nonchat-operations-v1
taskId
required
string
requestId
required
string
operation
required
string
model
required
string
status
required
Any of:
string
Allowed value: preparing
pollIntervalMs
required
integer
>= 1000
retainedUntil
required
string
resultAvailable
required
boolean
result
meter
object
errorCode
string
billing
required
object
state
required
Any of:
string
Allowed value: unreserved
cost
required
Any of:
string
Example
{
"protocol": "nonchat-operations-v1",
"status": "preparing",
"billing": {
"state": "unreserved"
}
}

Accepted operation and initial connection material; replay can omit connection material

Media typeapplication/json
object
protocol
required
string
Allowed value: nonchat-operations-v1
taskId
required
string
requestId
required
string
operation
required
string
model
required
string
status
required
Any of:
string
Allowed value: preparing
pollIntervalMs
required
integer
>= 1000
retainedUntil
required
string
resultAvailable
required
boolean
result
meter
object
errorCode
string
billing
required
object
state
required
Any of:
string
Allowed value: unreserved
cost
required
Any of:
string
sessionId
string
connectPath
string
connectTicket
string
expiresAt
string
Example
{
"protocol": "nonchat-operations-v1",
"status": "preparing",
"billing": {
"state": "unreserved"
}
}

No verified bounded realtime binding configured