Skip to content
Tài liệu API

OpenAI Responses ​

API OpenAI Responses hiện đại (POST /v1/responses) hỗ trợ luồng mục có cấu trúc, kiểm soát mức độ suy luận, quy trình làm việc của Codex CLI, nén ngữ cảnh (POST /v1/responses/compact) và chế độ WebSocket (GET /v1/responses).

POSThttps://api.vanix.io/v1/responses
Thử nghiệm trực tiếpPOST /v1/responses

Các tham số chính ​

modelstringbắt buộc
Mã mô hình hỗ trợ Responses API (ví dụ: gpt-5, gpt-5-mini, gpt-4o, o3).
inputstring | array<object>bắt buộc
Chuỗi văn bản thuần hoặc mảng có cấu trúc các mục đầu vào (tin nhắn, hình ảnh, kết quả công cụ).
instructionsstringtùy chọn
Chỉ dẫn hệ thống/lập trình viên ưu tiên cao được đặt trước lượt gọi.
reasoningobjecttùy chọn
Cấu hình mức độ suy luận và chế độ tóm tắt, ví dụ: {"effort": "medium"}.
max_output_tokensintegertùy chọn
Giới hạn cứng tối đa cho tổng số token đầu ra và token suy luận được sinh ra.
streambooleantùy chọnmặc định: false
Truyền phát các sự kiện SSE định kiểu của Responses (response.output_text.delta, response.completed).

Ví dụ mã nguồn ​

bash
curl https://api.vanix.io/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $VANIX_API_KEY" \
  -d '{
    "model": "gpt-5-mini",
    "instructions": "Respond as a concise cloud engineer.",
    "input": "List 3 advantages of ARM64 Graviton containers."
  }'
python
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["VANIX_API_KEY"], base_url="https://api.vanix.io/v1")
resp = client.responses.create(
    model="gpt-5-mini",
    instructions="Respond as a concise cloud engineer.",
    input="List 3 advantages of ARM64 Graviton containers.",
)
print(resp.output_text)
ts
import OpenAI from 'openai'

const client = new OpenAI({ apiKey: process.env.VANIX_API_KEY, baseURL: 'https://api.vanix.io/v1' })
const resp = await client.responses.create({
  model: 'gpt-5-mini',
  instructions: 'Respond as a concise cloud engineer.',
  input: 'List 3 advantages of ARM64 Graviton containers.',
})
console.log(resp.output_text)

Các điểm cuối liên quan ​

  • POST /v1/responses/compact — Nén lịch sử hội thoại dài dành cho các agent lập trình.
  • WS /v1/realtime?model=gpt-4o-realtime-preview — Realtime WebSocket hai chiều cho âm thanh và văn bản (OpenAI-Beta: realtime=v1).

Vanix AI Cổng API Hợp Nhất · https://api.vanix.io