# "nén ngữ cảnh gpt"

Nguồn: https://docs.openaihub.net/api-45208853/

> 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

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/responses/compact:
    post:
      summary: nén ngữ cảnh gpt
      deprecated: false
      description: Nén ngữ cảnh trò chuyện GPT để giảm số lượng token cho các yêu cầu sau.
      operationId: v1_responses_compact
      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: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              properties:
                input:
                  type: array
                  items:
                    type: object
                    required:
                      - type
                      - role
                      - content
                    properties:
                      content:
                        type: string
                        description: Nội dung thông điệp
                      role:
                        type: string
                        description: >-
                          Vai trò của tin nhắn, các giá trị tùy chọn:
                          user/assistant/system
                      type:
                        type: string
                        description: Loại thông điệp, giá trị cố định là message
                    x-apifox-orders:
                      - content
                      - role
                      - type
                    x-apidog-orders:
                      - content
                      - role
                      - type
                  description: Danh sách các tin nhắn trong lịch sử cần được nén
                model:
                  type: string
                  description: Tên mô hình, chẳng hạn như gpt-5-codex
              refName: PostV1ResponsesCompactRequest
              x-apifox-orders:
                - input
                - model
              x-apidog-orders:
                - input
                - model
            examples:
              gpt_5_4:
                value:
                  input:
                    - content: Xin chào, đây là một bài kiểm tra ngắn gọn.
                      role: user
                      type: message
                  model: gpt-5.4
                summary: gpt_5_4
                description: nén ngữ cảnh gpt
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                x-apidog-orders: []
              examples:
                example:
                  summary: example
                  value: '[long payload omitted: 1,684 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-45208853-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.openaihub.net
    description: Prod Env
security: []

```
