OpenAI Live
Send a request through RunAPI's OpenAI-compatible Live operation.
Visão geral
Use RunAPI's OpenAI-compatible Live operation with a compatible model and the protocol's request and response shapes.
Início rápido
- Crie uma Chave de API e defina-a como RUNAPI_API_KEY.
- Escolha um modelo compatível, depois envie os parâmetros de caminho e o corpo JSON documentados.
- Leia a resposta JSON ou os eventos enviados pelo servidor exibidos para esta operação e trate os erros de protocolo.
Endpoint
- URL base
https://runapi.ai- Versão do contrato
v1- Autenticação preferida
Authorization: Bearer YOUR_API_TOKEN
Portadores de autenticação
O RunAPI aceita cada carrier listado abaixo. Os exemplos gerados usam o cabeçalho preferido do protocolo.
- header - Preferido
Authorization: Bearer YOUR_API_TOKEN- header
x-api-key: YOUR_API_TOKEN
Modelos compatíveis
Abra uma página de modelo para ver preços atuais, limites de taxa e detalhes de uso comercial.
Mostrar 1 modelo compatível
Contrato de solicitação
Apenas os campos com evidências de suporte tanto no protocolo público quanto no RunAPI são listados. Campos adicionais no corpo JSON são repassados diretamente.
Corpo JSON18 campos
delegation["object", "null"]Contrato opcional de delegação client ou Responses, no formato do provedor.
delegation.responsesobjectConfigurações de backend do trabalho delegado quando type é responses.
delegation.responses.instructionsstringPrompt de backend para o trabalho delegado.
delegation.responses.max_output_tokensintegerOrçamento de tokens de saída da resposta delegada; no mínimo 16.
delegation.responses.modelstringModelo Responses que executa o trabalho delegado.
delegation.responses.parallel_tool_callsbooleanAllow independent delegated tool calls in one turn.
delegation.responses.reasoningobjectReasoning settings for the delegated model.
delegation.responses.service_tierstringService tier requested for the delegated response.
delegation.responses.textobjectText output settings for the delegated response.
delegation.responses.tool_choice["string", "object"]Which delegated tools the backend may use.
delegation.responses.toolsarrayFerramentas Responses hospedadas que a chamada delegada pode usar.
delegation.responses.tools[].typestringweb_search, web_search_preview, file_search, computer_use_preview
delegation.toolsarrayFerramentas function pertencentes ao cliente quando type é client.
delegation.tools[].typestringdelegation.typestringclient, responses
modelstringRunAPI model identifier; Live currently supports gpt-live-1.
sdpstringClient SDP offer for the WebRTC session.
transportstringWebRTC session negotiation transport.
Exemplo de solicitação
{
"delegation": {
"responses": {
"model": "gpt-5.6-terra",
"tools": [
{
"type": "web_search"
}
]
},
"type": "responses"
},
"model": "gpt-live-1",
"sdp": "v=0",
"transport": "webrtc"
}
Resposta síncrona
Esquema
{
"additionalProperties": true,
"properties": {
"session": {
"additionalProperties": true,
"type": "object"
},
"transport": {
"additionalProperties": true,
"type": "object"
}
},
"required": [
"session",
"transport"
],
"type": "object"
}
Exemplo
{
"session": {
"id": "live_123"
},
"transport": {
"sdp": "answer",
"type": "webrtc"
}
}
Erro de protocolo: invalid_request
Esquema
{
"additionalProperties": true,
"properties": {
"error": {
"additionalProperties": true,
"properties": {
"code": {
"type": [
"string",
"null"
]
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
}
},
"required": [
"message",
"type"
],
"type": "object"
}
},
"required": [
"error"
],
"type": "object"
}
Exemplo
{
"error": {
"code": null,
"message": "Invalid Live session request",
"param": "sdp",
"type": "invalid_request_error"
}
}
Uso
Esquema
{
"additionalProperties": true,
"properties": {
"duration_seconds": {
"type": "number"
}
},
"required": [
"duration_seconds"
],
"type": "object"
}
Exemplo
{
"duration_seconds": 3
}
Exemplos de Código Gerados
Cada exemplo em cURL, JavaScript e Python envia a requisição validada deste contrato sem exigir um SDK específico do protocolo.
Instalar
pip install requests
import requests
response = requests.post(
"https://runapi.ai/v1/live/webrtc",
headers={"Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json"},
json={"model": "gpt-live-1", "transport": "webrtc", "sdp": "v=0", "delegation": {"type": "responses", "responses": {"model": "gpt-5.6-terra", "tools": [{"type": "web_search"}]}}}
)
response.raise_for_status()
print(response.json())