Zum Inhalt springen
API-Referenz
API-Referenz

OpenAI Live

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

01

Übersicht

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

Schnellstart

  1. Erstellen Sie einen API-Schlüssel und setzen Sie ihn als RUNAPI_API_KEY.
  2. Wählen Sie ein kompatibles Modell, senden Sie dann die dokumentierten Pfadparameter und den JSON-Body.
  3. Lesen Sie die für diesen Vorgang angezeigte JSON-Antwort oder die server-sent events und behandeln Sie Protokollfehler.

Endpunkt

POST /v1/live/webrtc
Basis-URL
https://runapi.ai
Vertragsversion
v1
Bevorzugte Authentifizierung
Authorization: Bearer YOUR_API_TOKEN
02

Authentifizierungsträger

RunAPI akzeptiert jeden der unten aufgeführten Träger. Generierte Beispiele verwenden den bevorzugten Header des Protokolls.

header - Bevorzugt
Authorization: Bearer YOUR_API_TOKEN
header
x-api-key: YOUR_API_TOKEN
03

Kompatible Modelle

Öffnen Sie eine Modellseite für aktuelle Preise, Ratenlimits und Details zur kommerziellen Nutzung.

1 kompatibles Modell anzeigen
04

Anfrage-Vertrag

JSON-Body

Es werden nur Felder aufgeführt, für die sowohl öffentliche Protokoll- als auch RunAPI-Unterstützung belegt ist. Weitere JSON-Body-Felder werden durchgereicht.

JSON-Body15 Felder
delegation["object", "null"]
Optional

Optional client or Responses delegation contract.

delegation.instructionsstring
Optional

Backend prompt for delegated work when type is responses.

delegation.max_output_tokensinteger
Optional

Output token budget for the delegated response.

delegation.modelstring
Optional

Responses model that runs delegated work when type is responses.

delegation.parallel_tool_callsboolean
Optional

Allow independent delegated tool calls in one turn.

delegation.reasoningobject
Optional

Reasoning settings for the delegated model.

delegation.service_tierstring
Optional

Service tier requested for the delegated response.

delegation.textobject
Optional

Text output settings for the delegated response.

delegation.tool_choice["string", "object"]
Optional

Which delegated tools the backend may use.

delegation.toolsarray
Optional

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

delegation.tools[].typestring
Erforderlich
delegation.typestring
Optional Zulässige Werte: client, responses
modelstring
Erforderlich

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

sdpstring
Erforderlich

Client SDP offer for the WebRTC session.

transportstring
Erforderlich

WebRTC session negotiation transport.

Anfragebeispiel

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

Synchrone Antwort

HTTP 201

Schema

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

Beispiel

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

Protokollfehler: invalid_request

HTTP 400

Schema

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

Beispiel

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

Verwendung

Schema

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

Beispiel

JSON
{
  "duration_seconds": 3
}
08

Generierte Code-Beispiele

Jedes cURL-, JavaScript- und Python-Beispiel sendet die validierte Anfrage aus diesem Vertrag, ohne ein protokollspezifisches SDK zu benötigen.

Installieren

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())