Overview
Gemini Flash is Google's fast multimodal model. OCRRouter sends the file with a fixed transcription prompt and gets Markdown back as text.
The model returns one text answer for the whole file. OCRRouter asks it to mark each page and splits on those marks.
Price and limits
- Model ID
- google/gemini-flash
- Price
- 15 credits / page ($15 per 1,000 pages)
- Max pages per request
- 1,000
- Inputs
- PDF; Images; Sent inline as base64
- Languages
- 100+ languages
- Positions (bbox)
- No, text only
- Up to 1,000 pages per document in OCRRouter
- Output length is bounded by the model's output token limit
You pay only for pages that succeed. A failed attempt that falls back to another model is not charged. See pricing.
How OCRRouter calls it
- Endpoint
- POST https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent
- Model
- GEMINI_OCR_MODEL, default gemini-flash-latest
- Request
- One user turn: inline_data (file as base64 with its MIME type), then the OCR prompt as text
- Fallback
- No Gemini key: Chat Completions on AIHubMix (default gemini-3.8-flash) or OpenRouter (default google/gemini-3.8-flash)
Options
What OCRRouter sets on the upstream call. You choose the model, format and pages in your request; vendor-specific options are not passed through.
- generationConfig.temperature
- 0
- Prompt
- Fixed: transcribe every page exactly as Markdown, LaTeX for formulas, a <!-- page:N --> line before each page, no code fence
- maxOutputTokens
- Not set: model default
- Client options
- Clients cannot pass Gemini-specific options through OCRRouter
Raw response fields
Every field the upstream documents, with its type and meaning taken from the vendor's own reference. Fields marked "read by OCRRouter" are the ones our connector uses; the rest are listed so you know what the engine produces.
Gemini generateContent response
GenerateContentResponse from the Gemini API. Fields follow Google's API reference.
Source: Gemini API: generateContent, retrieved 2026-11-19
candidatesCandidate[], read by OCRRouter- Candidate responses from the model.
candidates[].indexinteger- Position of the candidate in the list.Example:
0 candidates[].content.rolestring- Producer of the content, model.Example:
"model" candidates[].content.parts[].textstring, read by OCRRouter- Inline text of the part.
candidates[].finishReasonenum- Why generation stopped, such as STOP, MAX_TOKENS or SAFETY.Example:
"STOP" candidates[].finishMessagestring- More detail on the stop reason.
candidates[].safetyRatingsSafetyRating[]- Safety ratings, at most one per category.
candidates[].citationMetadataCitationMetadata- Source attributions for the content.
candidates[].tokenCountinteger- Token count for this candidate.
candidates[].groundingAttributionsGroundingAttribution[]- Sources behind a grounded answer (GenerateAnswer calls).
candidates[].groundingMetadataGroundingMetadata- Grounding information for GenerateContent calls.
candidates[].avgLogprobsnumber- Average log probability of the candidate.
candidates[].logprobsResultLogprobsResult- Log-likelihoods for response tokens and top alternatives.
candidates[].urlContextMetadataUrlContextMetadata- Metadata from the URL context tool.
promptFeedbackPromptFeedback- Content filter feedback on the prompt, including blockReason.
usageMetadata.promptTokenCountinteger- Prompt tokens, including cached content.
usageMetadata.cachedContentTokenCountinteger- Tokens in the cached part of the prompt.
usageMetadata.candidatesTokenCountinteger- Tokens across all generated candidates.
usageMetadata.toolUsePromptTokenCountinteger- Tokens in tool-use prompts.
usageMetadata.thoughtsTokenCountinteger- Tokens used for thinking, on thinking models.
usageMetadata.totalTokenCountinteger- Total tokens for the request.
usageMetadata.promptTokensDetailsModalityTokenCount[]- Prompt tokens per modality.
usageMetadata.cacheTokensDetailsModalityTokenCount[]- Cached tokens per modality.
usageMetadata.candidatesTokensDetailsModalityTokenCount[]- Response tokens per modality.
usageMetadata.toolUsePromptTokensDetailsModalityTokenCount[]- Tool-use input tokens per modality.
usageMetadata.serviceTierenum- Service tier of the request: standard, flex, priority or unspecified.
modelVersionstring- Model version that produced the response.
responseIdstring- ID of the response.
modelStatusModelStatus- Current status of the model, such as stage and retirement time.
Shape from Google's generateContent reference; text replaced with OCR output, values illustrative.
{"candidates": [{"content": {"parts": [{ "text": "<!-- page:1 -->\n# Invoice 1042\n..." }],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 1290,"candidatesTokenCount": 412,"totalTokenCount": 1702},"modelVersion": "gemini-flash-latest","responseId": "mVqBaPKFEoeZ1dkP7Lj0wQ8"}Gateway response: Chat Completions
Used when no direct vendor key is set. OCRRouter calls POST /chat/completions on AIHubMix or OpenRouter, which return OpenAI's chat completion object. Fields follow OpenAI's reference.
Source: OpenAI chat completion object, retrieved 2026-11-19
idstring- Unique ID of the chat completion.Example:
"chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG" objectstring- Always chat.completion.Example:
"chat.completion" createdinteger- Unix time in seconds when the completion was created.Example:
1741570283 modelstring- Model used for the completion.
choicesarray, read by OCRRouter- Completion choices; more than one only when n > 1.
choices[].indexinteger- Position of the choice in the list.Example:
0 choices[].message.rolestring- Role of the message author, assistant.Example:
"assistant" choices[].message.contentstring | null, read by OCRRouter- Text of the message.
choices[].message.refusalstring | null- Refusal message from the model, if any.
choices[].message.annotationsarray- Annotations such as web search citations, when applicable.
choices[].message.tool_callsarray- Tool calls generated by the model.
choices[].finish_reasonstring- Why generation stopped: stop, length, content_filter, tool_calls or function_call.Example:
"stop" choices[].logprobsobject | null- Log probability information for the choice.
usage.prompt_tokensinteger- Tokens in the prompt.
usage.completion_tokensinteger- Tokens in the generated completion.
usage.total_tokensinteger- Prompt plus completion tokens.
usage.prompt_tokens_detailsobject- Breakdown of prompt tokens, such as cached tokens.
usage.completion_tokens_detailsobject- Breakdown of completion tokens, such as reasoning tokens.
service_tierstring | null- Processing tier used for the request.
system_fingerprintstring- Backend configuration the model ran with.
errorobject, read by OCRRouter- Not part of OpenAI's object. Gateways may return an error object in a 200 body; OCRRouter treats it as a failure.
Shape from OpenAI's chat completion object example; content replaced with OCR output, values shortened.
{"id": "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG","object": "chat.completion","created": 1741570283,"model": "MODEL","choices": [{"index": 0,"message": {"role": "assistant","content": "<!-- page:1 -->\n# Invoice 1042\n...","refusal": null,"annotations": []},"logprobs": null,"finish_reason": "stop"}],"usage": {"prompt_tokens": 1117,"completion_tokens": 46,"total_tokens": 1163,"prompt_tokens_details": { "cached_tokens": 0 },"completion_tokens_details": { "reasoning_tokens": 0 }},"service_tier": "default","system_fingerprint": "fp_fc9f1d7035"}How it maps to OCRRouter output
- candidates[0].content.parts[].text
- Joined into one string (direct path)
- choices[0].message.content
- The text, string or array of text parts joined (gateway path)
- <!-- page:N --> markers
- Text split into pages[]; a stray code fence is removed; no markers means one page; extra pages are merged into the last
- Empty text
- Request fails with "Provider returned no text"
- Layout and confidence
- None: no bbox or confidence from this model
The unified output is described in Response format.
Example request
curl https://api.ocrrouter.ai/v1/ocr \
-H "Authorization: Bearer $OCRROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-flash",
"file_url": "https://example.com/invoice.pdf",
"format": "json"
}'Sources
Vendor documentation read on 2026-11-19.