Image OCR
POST https://tools.yukai.uk/api/v1/ocr
Extract text from an image (OCR). Reads all text in a photo, scan or screenshot (receipts, invoices, documents, signs, labels, menus, screenshots; many languages and scripts (20+ tested) including Chinese, Japanese and Korean) with an AI vision model (Llama 4 Scout) instructed to transcribe verbatim: nothing is translated, summarized or corrected. Send an image URL (GET or POST), a base64 image (POST JSON), a file upload (POST multipart/form-data, field image) or the raw image bytes (POST with Content-Type: image/*, options in the query string). Images without text return noText: true. Identical images are served from a 24-hour cache.
Cost
Credits: 27 ($0.0027) per successful call. Failed calls are free. Source price: image-to-text-ocr/image-ocr.
Input
Send a JSON body (POST) or the same fields as a query string (GET).
No field is required.
| Field | Type | Default | Description |
|---|---|---|---|
url | string | Public image URL (JPEG, PNG, WebP or GIF, up to 6 MB). Google Drive, Dropbox and OneDrive share links work. Private, local and cloud-metadata addresses are refused on every redirect. Alias: imageUrl. For POST you can send image instead. | |
format | string | "text" | text (default): plain text, tables as tab-separated rows. markdown: Markdown with headings, lists and tables. lines: plain text plus a lines array (one string per non-empty line; no coordinates). |
language | string | Optional hint for the main language of the text, as a name (Japanese, German, Traditional Chinese). Helps with small or stylized script. The text is never translated. | |
image | string | The image itself as base64 or a data URL (data:image/png;base64,...), up to 6 MB decoded. POST only. Aliases: imageBase64, base64. |
Examples
Replace tt_live_XXXX with your key from the pricing page.
curl
curl -i -X POST "https://tools.yukai.uk/api/v1/ocr" \
-H "Authorization: Bearer tt_live_XXXX" \
-H "Content-Type: application/json" \
-d '{"url":"https://upload.wikimedia.org/wikipedia/commons/0/08/China_nutrition_facts_label.png","format":"markdown"}'JavaScript (fetch)
const res = await fetch("https://tools.yukai.uk/api/v1/ocr", {
method: "POST",
headers: { "Authorization": "Bearer tt_live_XXXX", "Content-Type": "application/json" },
body: JSON.stringify({"url":"https://upload.wikimedia.org/wikipedia/commons/0/08/China_nutrition_facts_label.png","format":"markdown"}),
});
console.log(res.status, res.headers.get("x-credits-charged"), res.headers.get("x-credits-balance"));
console.log(await res.json());Python (requests)
import requests
r = requests.post(
"https://tools.yukai.uk/api/v1/ocr",
headers={"Authorization": "Bearer tt_live_XXXX"},
json={"url": "https://upload.wikimedia.org/wikipedia/commons/0/08/China_nutrition_facts_label.png", "format": "markdown"},
timeout=120,
)
print(r.status_code, r.headers.get("x-credits-charged"), r.headers.get("x-credits-balance"))
print(r.json())
Response
JSON with "success": true and the result fields; on failure {"success": false, "error": {"code", "message", "retryable"}} and no credits are used. Every answer carries x-credits-charged (credits used) and x-credits-balance (balance after the call); check the balance any time with GET https://tools.yukai.uk/v1/billing/balance.
Full field list and response schema: OpenAPI spec image-ocr (its servers entry is the marketplace gateway; call https://tools.yukai.uk with your key).