OpenAI Live
Send a request through RunAPI's OpenAI-compatible Live operation.
نظرة عامة
Use RunAPI's OpenAI-compatible Live operation with a compatible model and the protocol's request and response shapes.
البدء السريع
- أنشئ مفتاح API واضبطه كـ RUNAPI_API_KEY.
- اختر نموذجاً متوافقاً، ثم أرسل معاملات المسار الموثَّقة وجسم JSON.
- اقرأ استجابة JSON أو أحداث الخادم المُرسَلة المعروضة لهذه العملية، وتعامل مع أخطاء البروتوكول.
نقطة النهاية
- عنوان URL الأساسي
https://runapi.ai- إصدار العقد
v1- المصادقة المفضّلة
Authorization: Bearer YOUR_API_TOKEN
وسائل حمل المصادقة
يقبل RunAPI كل بروتوكول مُدرج أدناه. تستخدم العينات المُولَّدة الترويسة المفضَّلة للبروتوكول.
- header - مفضّل
Authorization: Bearer YOUR_API_TOKEN- header
x-api-key: YOUR_API_TOKEN
النماذج المتوافقة
افتح صفحة النموذج للاطلاع على التسعير الحالي وحدود المعدل وتفاصيل الاستخدام التجاري.
عرض 1 نموذج متوافق
عقد الطلب
تُدرج فقط الحقول التي تتوفر لها أدلة دعم من بروتوكول عام ومن RunAPI. تُمرَّر حقول نص JSON الإضافية كما هي.
جسم JSON18 حقل
delegation["object", "null"]عقد تفويض اختياري لـ client أو Responses، بصيغة المزوّد.
delegation.responsesobjectإعدادات الخلفية للعمل المفوَّض عندما تكون قيمة type هي responses.
delegation.responses.instructionsstringموجّه الخلفية للعمل المفوَّض.
delegation.responses.max_output_tokensintegerميزانية رموز الإخراج للاستجابة المفوَّضة؛ 16 على الأقل.
delegation.responses.modelstringنموذج Responses الذي ينفّذ العمل المفوَّض.
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.toolsarrayأدوات Responses المستضافة التي يمكن للاستدعاء المفوَّض استخدامها.
delegation.responses.tools[].typestringweb_search, web_search_preview, file_search, computer_use_preview
delegation.toolsarrayأدوات function المملوكة للعميل عندما تكون قيمة 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.
مثال على الطلب
{
"delegation": {
"responses": {
"model": "gpt-5.6-terra",
"tools": [
{
"type": "web_search"
}
]
},
"type": "responses"
},
"model": "gpt-live-1",
"sdp": "v=0",
"transport": "webrtc"
}
استجابة متزامنة
المخطط
{
"additionalProperties": true,
"properties": {
"session": {
"additionalProperties": true,
"type": "object"
},
"transport": {
"additionalProperties": true,
"type": "object"
}
},
"required": [
"session",
"transport"
],
"type": "object"
}
مثال
{
"session": {
"id": "live_123"
},
"transport": {
"sdp": "answer",
"type": "webrtc"
}
}
خطأ في البروتوكول: invalid_request
المخطط
{
"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"
}
مثال
{
"error": {
"code": null,
"message": "Invalid Live session request",
"param": "sdp",
"type": "invalid_request_error"
}
}
الاستخدام
المخطط
{
"additionalProperties": true,
"properties": {
"duration_seconds": {
"type": "number"
}
},
"required": [
"duration_seconds"
],
"type": "object"
}
مثال
{
"duration_seconds": 3
}
نماذج الأكواد المولَّدة
كل نموذج من نماذج cURL وJavaScript وPython يُرسل الطلب المُتحقق منه من هذا العقد دون الحاجة إلى SDK خاص بالبروتوكول.
التثبيت
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())