Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.gmicloud.ai/llms.txt

Use this file to discover all available pages before exploring further.

Model ID
tencent/HunyuanOCR

API Usage

You can interact with the HunyuanOCR model through various programming languages and methods. Below are examples showing how to use the model’s API.

API Examples

Generate a model response using the chat endpoint of HunyuanOCR.

Shell

curl https://api.gmi-serving.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer *************" \
    -d '{
  "model": "tencent/HunyuanOCR",
  "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "What is in this image?"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://ofasys-multimodal-wlcb-3-toshanghai.oss-accelerate.aliyuncs.com/wpf272043/keepme/image/receipt.png"
            }
          }
        ]
      }
    ],
  "temperature": 0,
  "max_tokens": 500
}'

Python

import requests
import json

url = "https://api.gmi-serving.com/v1/chat/completions"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer *************"
}

payload = {
    "model": "tencent/HunyuanOCR",
    "messages": [
        {
          "role": "user",
          "content": [
            {
              "type": "text",
              "text": "What is in this image?"
            },
            {
              "type": "image_url",
              "image_url": {
                "url": "https://ofasys-multimodal-wlcb-3-toshanghai.oss-accelerate.aliyuncs.com/wpf272043/keepme/image/receipt.png"
              }
            }
          ]
        }
      ],
    "temperature": 0,
    "max_tokens": 500
}

response = requests.post(url, headers=headers, json=payload)
print(json.dumps(response.json(), indent=2))

Openai-python

import os
from openai import OpenAI

client = OpenAI(
  base_url="https://api.gmi-serving.com/v1",
  api_key="<GMI_API_KEY>",
)

completion = client.chat.completions.create(
  model="tencent/HunyuanOCR",
  messages=[
              {
                "role": "user",
                "content": [
                  {
                    "type": "text",
                    "text": "What is in this image? give me more details"
                  },
                  {
                    "type": "image_url",
                    "image_url": {
                      "url": "https://ofasys-multimodal-wlcb-3-toshanghai.oss-accelerate.aliyuncs.com/wpf272043/keepme/image/receipt.png"
                    }
                  }
                ]
              }
            ]
)

print(completion.choices[0].message.content)