Extract document text
/model/v1/ocr● SupportedRequest body
modelstringrequiredOCR model ID, for example glm-ocr.
Verified to take effect.
documentobjectrequiredChoose document_url, image_url (HTTPS or data URL), or {type: file, file_id: string}.
Supports PDF data URLs, image_url and uploaded file_id; remote URLs must be downloadable.
Expand sub-fields (5)
typestringrequiredAlways
document_url. Discriminator of thetype-tagged union this object belongs to. Alwaysimage_url. Discriminator of thetype-tagged union this object belongs to. Alwaysfile. Discriminator of thetype-tagged union this object belongs to.document_urlstringoptionalHTTPS or base64 data URL; required when type is document_url. Required when type is document_url. Not used when type is image_url, file.
document_namestringoptionalOptional file name of the document, used by the provider for display. Not used when type is image_url, file.
image_urlstringoptionalHTTPS or base64 data URL; required when type is image_url. Required when type is image_url. Not used when type is document_url, file.
file_idstringoptionalFile ID owned by the authenticated tenant. The file_id read limit is 24 MiB (25165824 bytes; shared 96 MiB memory budget / 4); PNG/JPEG remain limited to 10 MiB. Larger files return 413: use HTTPS document_url for PDFs up to 50 MiB. Image pages must be [0]. Required when type is file. Not used when type is document_url, image_url.
pagesarrayoptionalZero-based page indices to process.
Zero-based page selection with deduplication; out-of-range pages error.
include_image_base64booleanoptional◐ Partially supportedInclude extracted images as base64.
glm-ocr accepts false only; true returns 400.
table_formatstringoptional◐ Partially supportedFormat for tables that are extracted separately: when set, tables come back in
tablesin this format and the page markdown keeps a link to each; when null they stay inline in the markdown. Router support (partial): glm-ocr accepts markdown or null only; html returns 400.glm-ocr accepts markdown or null only; html returns 400.
extract_headerbooleanoptional○ UnsupportedWhether to extract page headers separately into
header. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.Unsupported on glm-ocr; passing it returns 400.
extract_footerbooleanoptional○ UnsupportedWhether to extract page footers separately into
footer. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.Unsupported on glm-ocr; passing it returns 400.
bbox_annotation_formatobjectoptional○ UnsupportedStructured image annotations; OCR requires json_schema. Availability depends on the model.
Unsupported on glm-ocr; passing it returns 400.
Expand sub-fields (2)
typestringoptionalResponse format type of the annotation.
json_schemaobjectoptionalJSON Schema the annotation of each detected image region must follow.
document_annotation_formatobjectoptional○ UnsupportedStructured document annotation; OCR requires json_schema. Availability depends on the model.
Unsupported on glm-ocr; passing it returns 400.
Expand sub-fields (2)
typestringoptionalResponse format type of the annotation.
json_schemaobjectoptionalJSON Schema the document annotation must follow.
document_annotation_promptstringoptional○ UnsupportedInstruction for the document annotation, which says what to extract. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.
Unsupported on glm-ocr; passing it returns 400.
More parameters (4)
image_limitintegeroptional○ UnsupportedMaximum number of images to extract per document; null for no limit. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.
Unsupported on glm-ocr; passing it returns 400.
image_min_sizeintegeroptional○ UnsupportedMinimum height and width in pixels of images to extract; null for no minimum. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.
Unsupported on glm-ocr; passing it returns 400.
include_blocksbooleanoptional○ UnsupportedWhether to return layout
blocksfor each page. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.Unsupported on glm-ocr; passing it returns 400.
confidence_scores_granularitystringoptional○ UnsupportedLevel at which confidence scores are returned. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.
Unsupported on glm-ocr; passing it returns 400.
Returns
200
Uses the Mistral OCR request and response shape at /model/v1/ocr only. model is required; document accepts document_url or image_url (HTTPS or base64 data URL), or {type:"file", file_id:"<uploaded ID>"} to read a File owned by the authenticated tenant. qwen-vl-ocr-2025-11-20 supports PDF, JPG and PNG; the platform renders PDF pages in its document sandbox before recognition. The file_id read limit is 24 MiB (25,165,824 bytes: the shared 96 MiB memory budget divided by four). Larger files return 413 with guidance to use HTTPS document_url (PDF limit: 50 MiB). PNG/JPEG remain limited to 10 MiB; the bytes determine the type. Missing and other-tenant files both return 404. pages is an array of zero-based page indices; for images, only [0] is supported when supplied. File read failures are not billed, and request logs retain only the file_id, never the file content. Optional features depend on the model; unsupported options return 400. Errors use problem+json; providerOptions.praxis is not supported here.
Platform errors (auth, rate limits, validation) and OCR errors use problem+json; other model call errors follow the endpoint's own format (OpenAI or Anthropic) — see error codes
Request
curl
curl https://api.deepraxis.com/model/v1/ocr \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"qwen-vl-ocr-2025-11-20","document":{"type":"document_url","document_url":"https://arxiv.org/pdf/1706.03762"},"pages":[0]}'Python
import requests
opts = dict(
base_url="https://api.deepraxis.com/model/v1",
api_key="$PRAXIS_API_KEY",
)
resp = requests.post(
f"{opts['base_url']}/ocr",
headers={"Authorization": f"Bearer {opts['api_key']}"},
json={
"model": "qwen-vl-ocr-2025-11-20",
"document": {"type": "document_url", "document_url": "https://arxiv.org/pdf/1706.03762"},
"pages": [0],
},
)
print(resp.json())TypeScript
const opts = {
baseURL: "https://api.deepraxis.com/model/v1",
apiKey: "$PRAXIS_API_KEY",
};
const resp = await fetch(`${opts.baseURL}/ocr`, {
method: "POST",
headers: { Authorization: `Bearer ${opts.apiKey}`, "Content-Type": "application/json" },
body: JSON.stringify({
model: "qwen-vl-ocr-2025-11-20",
document: { type: "document_url", document_url: "https://arxiv.org/pdf/1706.03762" },
pages: [0],
}),
});
console.log(await resp.json());Response 200
{
"pages": [
{
"index": 0,
"markdown": "<div align=\"center\">\n\n# Attention Is All You Need\n\n</div>\n\nAshish Vaswani*\n\nGoogle Brain\n\navaswani@google.com\n\nNoam Shazeer* Google Brain noam@google.com\n\nNiki Parmar $ ^{*} $ Jakob Uszkoreit $ ^{*} $…(采样时截断:原文共 1667 字符,此处保留前 200)",
"images": [],
"dimensions": null
}
],
"model": "glm-ocr",
"usage_info": {
"pages_processed": 1,
"doc_size_bytes": 2215244
},
"document_annotation": null
}Response
HTTP 200
OCR pages and usage
application/json
| Name | Type | Description |
|---|---|---|
| pages | array<object> | Result per processed page, in page order. |
| pages[].index | integer | Zero-based index of the page in the document. |
| pages[].markdown | string | Page content as markdown. |
| pages[].images | array<object> | Images found on the page. |
| pages[].dimensions | object | null | Size of the rendered page; null when unknown. |
| pages[].tables | array<object> | Tables extracted from the page when table_format is set. |
| pages[].hyperlinks | array<string> | Hyperlinks found on the page. |
| pages[].header | string | null | Page header text; null when none was extracted. |
| pages[].footer | string | null | Page footer text; null when none was extracted. |
| pages[].blocks | array<object> | null | Layout blocks of the page, in reading order, when include_blocks is true. |
| pages[].confidence_scores | object | null | Confidence scores of the page; null when not requested. |
| model | string | OCR model that processed the document. |
| usage_info | object | Usage of the request. |
| usage_info.pages_processed | integer | Number of pages that were processed. |
| usage_info.doc_size_bytes | integer | null | Size of the document in bytes; null when unknown. |
| document_annotation | string | null | Document annotation as a JSON string, when document_annotation_format was requested; null otherwise. |