---
title: OpenAI Live | RunAPI
description: Send a request through RunAPI's OpenAI-compatible Live operation.
url: https://runapi.ai/zh-TW/docs/api/openai/live.md
canonical: https://runapi.ai/zh-TW/docs/api/openai/live
locale: zh-TW
---

> HTML 版本: https://runapi.ai/zh-TW/docs/api/openai/live
> 代理程式網站索引: https://runapi.ai/llms.txt

# OpenAI Live

## 概覽

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

### 快速入門

1. 建立 API 金鑰並將其設定為 RUNAPI_API_KEY。
2. 選擇相容的模型，然後傳送文件中指定的路徑參數與 JSON 本文。
3. 讀取此操作顯示的 JSON 回應或伺服器傳送事件，並處理協定錯誤。

## 端點

POST /v1/live/webrtc

基礎 URL: https://runapi.ai

合約版本: v1

建議的身分驗證方式: Authorization: Bearer YOUR_API_TOKEN

## 身分驗證載體

RunAPI 接受以下列出的每種傳輸協定。產生的範例使用該協定偏好的標頭。

- `Authorization: Bearer YOUR_API_TOKEN` (建議)
- `x-api-key: YOUR_API_TOKEN`

## 相容模型

開啟模型頁面以查看目前的定價、速率限制及商業用途詳情。

- [gpt-live-1](https://runapi.ai/zh-TW/models/gpt)

## 請求合約

僅列出同時具備公開協定與 RunAPI 支援依據的欄位。其他 JSON 本文欄位將直接傳遞。

### JSON 主體

必填: `model`, `transport`, `sdp`

```json
{
  "delegation": {
    "additionalProperties": true,
    "description": "Optional client or Responses delegation contract.",
    "properties": {
      "instructions": {
        "description": "Backend prompt for delegated work when type is responses.",
        "type": "string"
      },
      "max_output_tokens": {
        "description": "Output token budget for the delegated response.",
        "type": "integer"
      },
      "model": {
        "description": "Responses model that runs delegated work when type is responses.",
        "minLength": 1,
        "type": "string"
      },
      "parallel_tool_calls": {
        "description": "Allow independent delegated tool calls in one turn.",
        "type": "boolean"
      },
      "reasoning": {
        "additionalProperties": true,
        "description": "Reasoning settings for the delegated model.",
        "type": "object"
      },
      "service_tier": {
        "description": "Service tier requested for the delegated response.",
        "type": "string"
      },
      "text": {
        "additionalProperties": true,
        "description": "Text output settings for the delegated response.",
        "type": "object"
      },
      "tool_choice": {
        "description": "Which delegated tools the backend may use.",
        "type": [
          "string",
          "object"
        ]
      },
      "tools": {
        "description": "Hosted Responses tools, or client-owned function tools when type is client.",
        "items": {
          "additionalProperties": true,
          "properties": {
            "type": {
              "type": "string"
            }
          },
          "required": [
            "type"
          ],
          "type": "object"
        },
        "minItems": 1,
        "type": "array"
      },
      "type": {
        "enum": [
          "client",
          "responses"
        ],
        "type": "string"
      }
    },
    "type": [
      "object",
      "null"
    ]
  },
  "model": {
    "description": "RunAPI model identifier; Live currently supports gpt-live-1.",
    "type": "string"
  },
  "sdp": {
    "description": "Client SDP offer for the WebRTC session.",
    "minLength": 1,
    "type": "string"
  },
  "transport": {
    "const": "webrtc",
    "description": "WebRTC session negotiation transport.",
    "type": "string"
  }
}
```

### 請求範例

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

## 同步回應

HTTP 201

### 結構描述

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

### 範例

```json
{
  "session": {
    "id": "live_123"
  },
  "transport": {
    "sdp": "answer",
    "type": "webrtc"
  }
}
```

## 協定錯誤：invalid_request

HTTP 400

### 結構描述

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

### 範例

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

## 用量

### 結構描述

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

### 範例

```json
{
  "duration_seconds": 3
}
```

## 產生的程式碼範例

每個 cURL、JavaScript 和 Python 範例均會從此契約傳送經驗證的請求，無需特定協定的 SDK。

### curl

```curl
curl -X POST https://runapi.ai/v1/live/webrtc \
  -H Authorization:\ Bearer\ YOUR_API_TOKEN \
  -H Content-Type:\ application/json \
  -d \{\"model\":\"gpt-live-1\",\"transport\":\"webrtc\",\"sdp\":\"v\=0\",\"delegation\":\{\"type\":\"responses\",\"model\":\"gpt-5.6-terra\",\"tools\":\[\{\"type\":\"web_search_preview\"\}\]\}\}
```

### javascript

```javascript
const response = await fetch("https://runapi.ai/v1/live/webrtc", {
  method: "POST",
  headers: {
  "Authorization": "Bearer YOUR_API_TOKEN",
  "Content-Type": "application/json"
},
  body: JSON.stringify({
  "model": "gpt-live-1",
  "transport": "webrtc",
  "sdp": "v=0",
  "delegation": {
    "type": "responses",
    "model": "gpt-5.6-terra",
    "tools": [
      {
        "type": "web_search_preview"
      }
    ]
  }
})
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
console.log(data);
```

### python

#### 安裝

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

## 相關指南

- [身分驗證](https://runapi.ai/zh-TW/docs/guides/authentication.md)
- [快速入門](https://runapi.ai/zh-TW/docs/guides/llm-api/quickstart.md)

---

## RunAPI 的更多內容

- [首頁](https://runapi.ai/zh-TW/.md)
- [模型目錄](https://runapi.ai/zh-TW/models.md)
- [價格](https://runapi.ai/zh-TW/pricing.md)
- [提供商](https://runapi.ai/zh-TW/models)
- [文件](https://runapi.ai/zh-TW/docs/guides)
- [SDK](https://runapi.ai/zh-TW/sdk.md)
- [CLI](https://runapi.ai/zh-TW/cli.md)
- [MCP Server](https://runapi.ai/zh-TW/mcp.md)
- [Claude Code 與 Cursor](https://runapi.ai/zh-TW/claude-code-vs-cursor.md)
- [Cursor API 設定](https://runapi.ai/zh-TW/cursor-api-setup.md)
- [RunAPI 與 OpenRouter](https://runapi.ai/zh-TW/openrouter-alternative.md)
- [企業版](https://runapi.ai/zh-TW/contact.md)
- [聯絡我們](https://runapi.ai/zh-TW/contact.md)
- [服務條款](https://runapi.ai/zh-TW/terms.md)
- [隱私權](https://runapi.ai/zh-TW/privacy.md)
- [代理程式網站索引](https://runapi.ai/llms.txt)

聯絡我們: contact@runapi.ai

## 結構化資料

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-TW",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-TW",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/zh-TW/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-TW",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-TW",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/zh-TWicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-TW",
    "@type": "TechArticle",
    "headline": "OpenAI Live",
    "description": "Send a request through RunAPI's OpenAI-compatible Live operation.",
    "url": "https://runapi.ai/zh-TW/docs/api/openai/live",
    "mainEntityOfPage": "https://runapi.ai/zh-TW/docs/api/openai/live"
  }
]
```
