由 Baidu 提供
Document OCR (Baidu Unlimited-OCR, open weights), self-hosted in a TEE: turns page images into text with layout. Not a chat model, and it does not read a PDF file: render its pages to images first. One page: send the image with the text "<image>document parsing." and vllm_xargs: {ngram_size: 35, window_size: 128}. Several pages: put every page image in one message with the text "<image>Multi page parsing." and window_size 1024; pages come back separated by <PAGE> (with the one-page text only the first page is read). Several pages are read at a lower resolution, so send dense pages one per request. Always set skip_special_tokens: false.
33K
32,768 個詞元
8K
8,192 個詞元
$0.1
每 1M 詞元
$0.4
每 1M 詞元
IMAGE=$(base64 < page.png | tr -d '\n')
curl "https://router-api.0g.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-d @- <<EOF
{
"model": "unlimited-ocr",
"messages": [
{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "data:image/png;base64,${IMAGE}"}},
{"type": "text", "text": "<image>document parsing."}
]}
],
"skip_special_tokens": false,
"vllm_xargs": {"ngram_size": 35, "window_size": 128}
}
EOFTEE 驗證
使用 verify_tee 請求鏈上簽章驗證。回應的追蹤中包含 tee_verified 欄位。
{
"model": "unlimited-ocr",
"messages": [{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "data:image/png;base64,<PAGE_IMAGE>"}},
{"type": "text", "text": "<image>document parsing."}
]}],
"skip_special_tokens": false,
"vllm_xargs": {"ngram_size": 35, "window_size": 128},
"verify_tee": true
}供應商路由
使用 X-0G-Provider-* 請求標頭,控制哪個供應商處理您的請求。
X-0G-Provider-Address 固定供應商;X-0G-Provider-Identity 固定要透過該供應商的哪個上游進行路由。這兩個值都來自 GET /v1/providers 回應中的 address 與 provider_identity 欄位。兩者搭配即可指定某個供應商的特定上游。若兩者都不傳送,路由會依價格與健康狀況挑選,和先前完全相同。
curl "https://router-api.0g.ai/v1/chat/completions" \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-H "X-0G-Provider-Address: <PROVIDER_ADDRESS>" \
-H "X-0G-Provider-Identity: <UPSTREAM>" \
-H "X-0G-Provider-Sort: latency" \
-H "X-0G-Provider-Allow-Fallbacks: true" \
-d '{
"model": "unlimited-ocr",
"messages": [{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "data:image/png;base64,<PAGE_IMAGE>"}},
{"type": "text", "text": "<image>document parsing."}
]}],
"skip_special_tokens": false,
"vllm_xargs": {"ngram_size": 35, "window_size": 128}
}'僅限私人模型
此模型為私密模型。若要將請求固定至 TEE 支援的供應商,請加上 X-0G-Provider-Trust-Mode: private 標頭。此為選擇性設定,並非預設套用。
X-0G-Provider-Trust-Mode: private