Tạo phản hồi của mô hình
API origin:
https://api.openaihub.net. Chọn đúng nhóm API và model. Thông số dưới đây là bản tham chiếu kỹ thuật; chưa phải kết quả kiểm thử từng endpoint bằng tài khoản của bạn.
OpenAPI Specification
Phần tiêu đề “OpenAPI Specification”openapi: 3.0.1info: title: '' description: '' version: 1.0.0paths: /v1/responses: post: summary: Tạo phản hồi của mô hình deprecated: false description: >- https://platform.openai.com/docs/api-reference/responses/create
Một số mô hình OpenAI chỉ hỗ trợ định dạng Response, chẳng hạn như o3-pro, codex-mini-latest operationId: v1_responses tags: - OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Trò chuyện/Trò chuyện (Phản hồi) - Phản hồi parameters: - name: Content-Type in: header description: Content-Type của phần thân yêu cầu, thường là application/json required: true example: application/json schema: type: string - name: Accept in: header description: Content-Type dự kiến của phản hồi required: true example: application/json schema: type: string - name: Authorization in: header description: Khóa API Bearer required: false example: Bearer {{YOUR_API_KEY}} schema: type: string requestBody: content: application/json: schema: type: object properties: input: type: array items: type: object properties: content: type: string description: Nội dung tin nhắn hoặc yêu cầu role: type: string description: >- Vai trò của tin nhắn, ví dụ: system / user / assistant / model x-apifox-orders: - content - role x-apidog-orders: - content - role description: Vui lòng cung cấp nội dung tài liệu cần dịch. model: type: string description: >- Mã định danh của mô hình cần sử dụng. Để biết thêm thông tin về những mô hình có thể được sử dụng với Chat API, hãy xem bảng tương thích điểm cuối của mô hình. refName: PostV1ResponsesRequest x-apifox-orders: - input - model x-apidog-orders: - input - model examples: gpt_4_1: value: '[long payload omitted: 3,821 units]' summary: gpt_4_1 description: Tạo lệnh gọi hàm Sao chép responses: '200': description: '' content: application/json: schema: type: object required: - id - object - created - choices - usage properties: choices: type: array items: type: object properties: finish_reason: type: string description: 'Lý do kết thúc, ví dụ: stop, length' index: type: integer description: Chỉ mục của mục ứng viên message: type: object required: - role - content properties: content: type: string description: Nội dung tin nhắn hoặc yêu cầu role: type: string description: >- Vai trò của tin nhắn, ví dụ: system / user / assistant / model description: Vui lòng cung cấp nội dung tài liệu cần dịch. x-apifox-orders: - content - role x-apidog-orders: - content - role x-apifox-orders: - finish_reason - index - message x-apidog-orders: - finish_reason - index - message description: Danh sách các kết quả ứng viên created: type: integer description: Thời gian tạo (dấu thời gian Unix) id: type: string description: ID tài nguyên hoặc tác vụ object: type: string description: 'Định danh kiểu đối tượng, ví dụ: chat.completion' usage: type: object required: - prompt_tokens - completion_tokens - total_tokens properties: completion_tokens: type: integer description: Số lượng token hoàn thành prompt_tokens: type: integer description: Số lượng token trong lời nhắc total_tokens: type: integer description: Tổng số token description: Thống kê mức sử dụng token x-apifox-orders: - completion_tokens - prompt_tokens - total_tokens x-apidog-orders: - completion_tokens - prompt_tokens - total_tokens refName: PostV1ResponsesResponse x-apifox-orders: - choices - created - id - object - usage x-apidog-orders: - choices - created - id - object - usage examples: example: summary: example value: '[long payload omitted: 1,698 units]' headers: {} x-apidog-name: '' '400': description: Yêu cầu không hợp lệ hoặc xác thực thất bại content: application/json: schema: type: object required: - error properties: error: type: object required: - message - type properties: message: type: string description: Thông báo lỗi (thường kết thúc bằng mã yêu cầu) type: type: string description: Loại lỗi; các lỗi cổng cục bộ thường là new_api_error examples: - new_api_error x-apifox-orders: - message - type x-apidog-orders: - message - type refName: NewApiError x-apifox-orders: - error x-apidog-orders: - error examples: example: summary: example value: error: message: >- Yêu cầu không hợp lệ (mã yêu cầu: 20260805120000123456789AbCdEfGh) type: new_api_error headers: {} x-apidog-name: Yêu cầu không hợp lệ hoặc xác thực thất bại '401': description: Khóa API bị thiếu hoặc không hợp lệ content: application/json: schema: type: object required: - error properties: error: type: object required: - message - type properties: message: type: string description: Thông báo lỗi (thường kết thúc bằng mã yêu cầu) type: type: string description: Loại lỗi; các lỗi cổng cục bộ thường là new_api_error examples: - new_api_error x-apifox-orders: - message - type x-apidog-orders: - message - type refName: NewApiError x-apifox-orders: - error x-apidog-orders: - error examples: example: summary: example value: error: message: >- Mã thông báo không hợp lệ (request id: 20260805120000123456789AbCdEfGh) type: new_api_error headers: {} x-apidog-name: Khóa API bị thiếu hoặc không hợp lệ security: [] x-apidog-folder: OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Trò chuyện/Trò chuyện (Phản hồi) x-apidog-status: released x-run-in-apidog: https://app.apidog.com/web/project/1218648/apis/api-45208852-runcomponents: schemas: {} securitySchemes: {}servers: - url: https://api.openaihub.net description: Prod Envsecurity: []