İçeriğe geç
API Referansı
API Referansı

OpenAI Live

Send a request through RunAPI's OpenAI-compatible Live operation.

01

Genel Bakış

Use RunAPI's OpenAI-compatible Live operation with a compatible model and the protocol's request and response shapes.

Hızlı başlangıç

  1. Bir API anahtarı oluşturun ve RUNAPI_API_KEY olarak ayarlayın.
  2. Uyumlu bir model seçin, ardından belgelenen yol parametrelerini ve JSON gövdesini gönderin.
  3. Bu işlem için gösterilen JSON yanıtını veya sunucu tarafından gönderilen olayları okuyun ve protokol hatalarını işleyin.

Uç Nokta

POST /v1/live/webrtc
Temel URL
https://runapi.ai
Sözleşme sürümü
v1
Tercih edilen kimlik doğrulama
Authorization: Bearer YOUR_API_TOKEN
02

Kimlik doğrulama taşıyıcıları

RunAPI aşağıda listelenen her taşıyıcıyı kabul eder. Oluşturulan örnekler, protokolün tercih ettiği başlığı kullanır.

header - Tercih edilen
Authorization: Bearer YOUR_API_TOKEN
header
x-api-key: YOUR_API_TOKEN
03

Uyumlu modeller

Güncel fiyatlandırma, hız sınırları ve ticari kullanım ayrıntıları için bir model sayfası açın.

1 uyumlu model göster
04

İstek sözleşmesi

JSON gövdesi

Yalnızca hem genel protokol hem de RunAPI destek kanıtı olan alanlar listelenmektedir. Ek JSON gövde alanları doğrudan iletilir.

JSON gövdesi15 alan
delegation["object", "null"]
İsteğe bağlı

Optional client or Responses delegation contract.

delegation.instructionsstring
İsteğe bağlı

Backend prompt for delegated work when type is responses.

delegation.max_output_tokensinteger
İsteğe bağlı

Output token budget for the delegated response.

delegation.modelstring
İsteğe bağlı

Responses model that runs delegated work when type is responses.

delegation.parallel_tool_callsboolean
İsteğe bağlı

Allow independent delegated tool calls in one turn.

delegation.reasoningobject
İsteğe bağlı

Reasoning settings for the delegated model.

delegation.service_tierstring
İsteğe bağlı

Service tier requested for the delegated response.

delegation.textobject
İsteğe bağlı

Text output settings for the delegated response.

delegation.tool_choice["string", "object"]
İsteğe bağlı

Which delegated tools the backend may use.

delegation.toolsarray
İsteğe bağlı

Hosted Responses tools, or client-owned function tools when type is client.

delegation.tools[].typestring
Zorunlu
delegation.typestring
İsteğe bağlı İzin verilen değerler: client, responses
modelstring
Zorunlu

RunAPI model identifier; Live currently supports gpt-live-1.

sdpstring
Zorunlu

Client SDP offer for the WebRTC session.

transportstring
Zorunlu

WebRTC session negotiation transport.

İstek örneği

JSON
{
  "delegation": {
    "model": "gpt-5.6-terra",
    "tools": [
      {
        "type": "web_search_preview"
      }
    ],
    "type": "responses"
  },
  "model": "gpt-live-1",
  "sdp": "v=0",
  "transport": "webrtc"
}
05

Eş zamanlı yanıt

HTTP 201

Şema

JSON
{
  "additionalProperties": true,
  "properties": {
    "session": {
      "additionalProperties": true,
      "type": "object"
    },
    "transport": {
      "additionalProperties": true,
      "type": "object"
    }
  },
  "required": [
    "session",
    "transport"
  ],
  "type": "object"
}

Örnek

JSON
{
  "session": {
    "id": "live_123"
  },
  "transport": {
    "sdp": "answer",
    "type": "webrtc"
  }
}
06

Protokol hatası: invalid_request

HTTP 400

Şema

JSON
{
  "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"
}

Örnek

JSON
{
  "error": {
    "code": null,
    "message": "Invalid Live session request",
    "param": "sdp",
    "type": "invalid_request_error"
  }
}
07

Kullanım

Şema

JSON
{
  "additionalProperties": true,
  "properties": {
    "duration_seconds": {
      "type": "number"
    }
  },
  "required": [
    "duration_seconds"
  ],
  "type": "object"
}

Örnek

JSON
{
  "duration_seconds": 3
}
08

Oluşturulan Kod Örnekleri

Her cURL, JavaScript ve Python örneği, protokole özgü bir SDK gerektirmeden bu sözleşmedeki doğrulanmış isteği gönderir.

Yükle

Shell
pip install requests
PYTHON
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", "model": "gpt-5.6-terra", "tools": [{"type": "web_search_preview"}]}}
)
response.raise_for_status()
print(response.json())