Naar inhoud springen
API-referentie
API-referentie

OpenAI Live

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

01

Overzicht

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

Snelstart

  1. Maak een API-sleutel aan en stel deze in als RUNAPI_API_KEY.
  2. Kies een compatibel model en stuur de gedocumenteerde padparameters en JSON-body.
  3. Lees de JSON-respons of server-sent events die voor deze bewerking worden weergegeven, en handel protocollfouten af.

Eindpunt

POST /v1/live/webrtc
Basis-URL
https://runapi.ai
Contractversie
v1
Voorkeursauthenticatie
Authorization: Bearer YOUR_API_TOKEN
02

Authenticatiedragers

RunAPI accepteert elke hieronder vermelde carrier. Gegenereerde voorbeelden gebruiken de voorkeurskoptekst van het protocol.

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

Compatibele modellen

Open een modelpagina voor actuele prijzen, snelheidslimieten en details over commercieel gebruik.

Toon 1 compatibel model
04

Verzoekcontract

JSON-body

Alleen velden met zowel openbaar protocol als bewijs van RunAPI-ondersteuning worden vermeld. Aanvullende JSON-bodyvelden worden doorgegeven.

JSON-body15 velden
delegation["object", "null"]
Optioneel

Optional client or Responses delegation contract.

delegation.instructionsstring
Optioneel

Backend prompt for delegated work when type is responses.

delegation.max_output_tokensinteger
Optioneel

Output token budget for the delegated response.

delegation.modelstring
Optioneel

Responses model that runs delegated work when type is responses.

delegation.parallel_tool_callsboolean
Optioneel

Allow independent delegated tool calls in one turn.

delegation.reasoningobject
Optioneel

Reasoning settings for the delegated model.

delegation.service_tierstring
Optioneel

Service tier requested for the delegated response.

delegation.textobject
Optioneel

Text output settings for the delegated response.

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

Which delegated tools the backend may use.

delegation.toolsarray
Optioneel

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

delegation.tools[].typestring
Verplicht
delegation.typestring
Optioneel Toegestane waarden: client, responses
modelstring
Verplicht

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

sdpstring
Verplicht

Client SDP offer for the WebRTC session.

transportstring
Verplicht

WebRTC session negotiation transport.

Verzoekvoorbeeld

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

Synchroon antwoord

HTTP 201

Schema

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

Voorbeeld

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

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

Voorbeeld

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

Gebruik

Schema

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

Voorbeeld

JSON
{
  "duration_seconds": 3
}
08

Gegenereerde codevoorbeelden

Elk cURL-, JavaScript- en Python-voorbeeld verstuurt de gevalideerde aanvraag uit dit contract zonder dat een protocolspecifieke SDK vereist is.

Installeren

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