Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

MaaS API

MaaS cung cấp một API tương thích với OpenAI để thực hiện suy luận mô hình một cách liền mạch. Bạn có thể dễ dàng tích hợp bằng Python, JavaScript SDK, hoặc trực tiếp qua terminal với cURL.

1. API tương thích OpenAI (Chat, Completion, Embedding, Image Generation)

Tham khảo các Script trong API Usage trên Portal

Curl

Python

Javascript


2. OCR API

OCR là một loại model trong MaaS, nhưng do đặc thù xử lý tài liệu (upload file, xử lý bất đồng bộ) nên có bộ endpoint riêng thay vì dùng endpoint tương thích OpenAI ở trên. Phần dưới đây hướng dẫn cách gọi OCR API.

Submit OCR (upload file để tạo request)

  • Method: POST

  • URL: https://maas-llm-aiplatform-hcm.api.vngcloud.vn/maas/user-<PORTAL_USER_ID>/greennode/idp/v1/ocr/ingest

  • Headers:

    • Authorization: Bearer <API_KEY>

    • portal-user-id: <PORTAL_USER_ID>

  • Body: multipart/form-data

    • flow (required)

      • single: OCR 1 tài liệu

      • hoặc <FLOW_ID>: OCR theo bộ tài liệu (nếu bạn được cấp flow)

    • doc_type (required nếu flow=single): <DOC_TYPE>

    • file_type (required): PDF hoặc IMAGE

    • file (required): file cần OCR

Ví dụ

Response sẽ chứa:

  • request_id: dùng để lấy kết quả

  • (tuỳ trường hợp) file_ids: dùng để tải ảnh kết quả

Get OCR Result (dùng request_id để lấy text/data)

  • Method: GET

  • URL: https://maas-llm-aiplatform-hcm.api.vngcloud.vn/maas/user-<PORTAL_USER_ID>/greennode/idp/v1/ocr/ingest/<request_id>

  • Headers:

    • Authorization: Bearer <API_KEY>

    • portal-user-id: <PORTAL_USER_ID>

Ví dụ

Nếu gọi ra chưa thấy data?

Điều này bình thường vì OCR đang xử lý.

  • Đợi 2–5 giây và gọi lại API này (polling).

  • Nếu quá thời gian timeout mà vẫn không có dữ liệu, gửi request_id cho team support để kiểm tra.

Các API lấy thêm dữ liệu khác của OCR (tuỳ nhu cầu)

Lấy bảng (TABLE)

  • Method: GET

  • URL: https://maas-llm-aiplatform-hcm.api.vngcloud.vn/maas/user-<PORTAL_USER_ID>/greennode/idp/v1/ocr/ingest/table/<request_id>/<document_id>

Lấy kết quả chữ ký

  • Method: GET

  • URL: https://maas-llm-aiplatform-hcm.api.vngcloud.vn/maas/user-<PORTAL_USER_ID>/greennode/idp/v1/ocr/ingest/signature/<request_id>/<document_id>

Note: document_id nằm trong response của Get OCR Result

Lấy kết quả con dấu

  • Method: GET

  • URL: https://maas-llm-aiplatform-hcm.api.vngcloud.vn/maas/user-<PORTAL_USER_ID>/greennode/idp/v1/ocr/ingest/stamp/<request_id>/<document_id>

Tải ảnh kết quả

  • Method: GET

  • URL: https://maas-llm-aiplatform-hcm.api.vngcloud.vn/maas/user-<PORTAL_USER_ID>/greennode/idp/v1/ocr/ingest/file/<request_id>/<file_id>

Troubleshooting nhanh cho OCR

  • 403 Forbidden:

    • Thiếu/sai Authorization hoặc không có quyền.

  • 400 Bad Request / 4XX:

    • Thiếu field bắt buộc (flow, file_type, file, ...)

    • doc_type không đúng theo cấu hình.

  • Polling mãi chưa ra kết quả:

    • Gửi request_id + thời điểm gọi + file mẫu (nếu được) cho team support.

Last updated