Compare
Gemini 2.5 Flash PDF extraction: the request, the price per page, and the measured fabrication rate
Gemini 2.5 Flash takes a PDF inline and returns JSON in the shape of a schema. This page has the exact request Velrim's published comparison of six extraction setups (September 2026) sent it, Google's prices and page-token rule as quoted on the day, and the model's numbers on 124 public documents: accuracy, how often it invented a value for a field the document did not contain, and the difference constrained decoding made. Velrim runs on this model and is in the same table, so the comparison is between the bare model and the pipeline around it.
The request
One generateContent call, the schema in the prompt text, the PDF as a base64 part, temperature 0 and nothing else set. This is the body Velrim's published comparison of six extraction setups (September 2026) sent for every document, with a two-field schema in place of the corpus schemas.
The prompt text is the sentence "Extract the following fields from the document. Return JSON matching this schema. Use null for fields not present in the document." followed by the JSON Schema. Every model in the comparison got these bytes. The same body runs on the Vertex AI endpoint for the same model pin, https://aiplatform.googleapis.com/v1/projects/<project>/locations/global/publishers/google/models/gemini-2.5-flash:generateContent, which is the route the comparison used.
Constrained decoding: two more fields
The constrained variant sends the identical prompt and adds a MIME type and the schema to the generation config. The model then cannot emit a token that breaks the schema.
This is an alternative toresponseSchemathat accepts JSON Schema. If set,responseSchemamust be omitted, butresponseMimeTypeis required. While the full JSON Schema may be sent, not all features are supported. Specifically, only the following properties are supported: $id $defs $ref $anchor type format title description enum (for strings and numbers) items prefixItems minItems maxItems minimum maximum anyOf oneOf (interpreted the same as anyOf) properties additionalProperties required.
responseSchema(deprecated) object (Schema). This item is deprecated! Optional. Output schema of the generated candidate text. Schemas must be a subset of the OpenAPI schema and can be objects, primitives or arrays. If set, a compatibleresponseMimeTypemust also be set.
As of 2026-09-03 the reference marks responseSchema deprecated and keeps responseJsonSchema with the list of supported keywords above. Google's structured outputs guide now documents the Interactions API on Gemini 3 models and does not mention gemini-2.5-flash or generateContent.
While generateContent remains fully supported, we recommend the Interactions API for all new development. In the Interactions API, output format controls move to a top-level response_format array. What Google says about pages, tokens and prices
Each document page is equivalent to 258 tokens.
Larger pages are scaled down to a maximum resolution of 3072 x 3072 while preserving their original aspect ratio, while smaller pages are scaled up to 768 x 768 pixels.
Gemini 2.5 Flash, Standard, Paid Tier, per 1M tokens in USD. Input price: $0.30 (text / image / video), $1.00 (audio). Output price: $2.50. Context caching price: $0.03 (text / image / video), $0.1 (audio), $1.00 / 1,000,000 tokens per hour. Last updated 2026-09-02 UTC.
Gemini 2.5 Flash, Free Tier. Input price: Free of charge. Output price: Free of charge. Context caching price: Not available. Used to improve our products: Yes.
gemini-2.5-flash. Release date: June 17, 2025. Shutdown date: No shutdown date announced.
The model card lists text, images, video and audio as inputs, a 1,048,576-token input limit, a 65,536-token output limit and a January 2025 knowledge cutoff (Gemini 2.5 Flash model card, read 2026-09-03).
Cost per 1,000 pages
| Per 1,000 pages | Gemini 2.5 Flash direct | Velrim |
|---|---|---|
| Page tokens at list price, 258 tokens a page at $0.30 per 1M | $0.08 | |
| Measured in the comparison, prompt, schema, page and answer tokens | ~$2.2 (measured, token-priced) | |
| List price, grounding and confidence included | $20 |
At 258 tokens a page and $0.30 per million input tokens, the pages themselves cost $0.08 per 1,000. The measured figure in Velrim's published comparison of six extraction setups (September 2026) came to ~$2.2 (measured, token-priced) over 319 pages at the paid tier. The gap is prompt and schema tokens on the input side and answer tokens at $2.50 per million on the output side. The free tier is priced at zero and, per the pricing page, the inputs are used to improve Google's products.
What the comparison measured
| Arm | macro-F1 (norm) | fabrication (absent fields) | wrong among the top 90% by confidence | $/1k pages |
|---|---|---|---|---|
| Velrim | 0.691 | 11.5% [6.1, 19.8] | 36.1% [29.9, 44.1] | $20 (list; measured matches) |
| Gemini free-decode | 0.709 | 17.0% [10.1, 26.7] | not requested | ~$2.2 (measured, token-priced) |
| Gemini constrained | 0.697 | 12.8% [7.6, 20.5] | not requested | ~$2.2 (measured, token-priced) |
| gpt-5.4-mini free | 0.735 | 10.8% [5.7, 18.4] | none surfaced | ~$1.0 (measured, prompt-cached) |
| gpt-5.4-mini structured | 0.718 | 10.4% [5.3, 17.6] | none surfaced | ~$1.0 (measured, prompt-cached) |
| Mistral OCR 4 | 0.712 | 40.3% [31.0, 52.5] | none surfaced | $5 (list; measured $5.3) |
124 public documents, 2102 fields, 96 of them absent by the audited answer key. Free-decode Gemini invented a value for 17.0% of the absent fields, interval [10.1, 26.7]. With constrained decoding, 12.8%, interval [7.6, 20.5]. Accuracy moved from 0.710 to 0.697 macro-F1. Pooled across all six setups the rate is 17%. Velrim, on the same model: 11.5%.
| Arm | fabrication (pooled, n=96) | all-attempted rule | answered when field present | completed/attempted |
|---|---|---|---|---|
| Velrim | 11.5% [6.1, 19.8] | 11.5% [6.1, 19.8] | 88.0% [84.0, 91.2] | 372/372 |
| Gemini free-decode | 17.0% [10.1, 26.7] | 15.6% [9.3, 24.4] | 96.5% [95.0, 97.7] | 328/372 |
| Gemini constrained | 12.8% [7.6, 20.5] | 11.1% [6.6, 18.1] | 96.7% [95.4, 97.9] | 315/372 |
| gpt-5.4-mini free | 10.8% [5.7, 18.4] | 10.8% | 96.1% [94.6, 97.3] | 372/372 |
| gpt-5.4-mini structured | 10.4% [5.3, 17.6] | 10.4% | 95.6% [93.0, 96.9] | 372/372 |
| Mistral OCR 4 | 40.3% [31.0, 52.5] | 40.3% | 96.6% [95.2, 97.9] | 372/372 |
The two Gemini rows completed 328/372 and 315/372 attempts. The shortfall was rate limiting on a new Google Cloud project at its default quota, plus one document that twice came back without usable JSON. Google's status page was clean for the window. On the other side of the fabrication column, Gemini answered 96.5% [95.0, 97.7] of the fields that were in the document and Velrim 88.0% [84.0, 91.2], so the lower invention rate is paid for in blanks.
The same call through Velrim
| Gemini 2.5 Flash direct | Velrim | |
|---|---|---|
| What comes back | JSON in the shape of the schema. With responseJsonSchema, the shape is enforced as the model writes. | The same JSON, plus a state, a 0 to 1 score and a page location for every field. |
| Fabrication on absent fields | Gemini 2.5 Flash free-decode: 17.0%. Gemini 2.5 Flash constrained: 12.8%. | 11.5% |
| Accuracy, macro-F1 | 0.710 and 0.697 | 0.691 |
| Answered when the field is present | 96.5% [95.0, 97.7] | 88.0% [84.0, 91.2] |
| Same document, three runs, answers differ | 12% and 23% of repeats | 36% of repeats, nearly all on nested line-item tables |
| Price per 1,000 pages | ~$2.2 (measured, token-priced) | $20 |
The score is one number per field, 0 to 1, with its error curve on the error curves page and the definition of the fabrication measure on the metric page. Grounding is a page number, a box and the matched text from the PDF's own word map, no second model call. Price is $0.02 per extracted page, prepaid from $5, about 500 pages free with no card.
Which to pick
Gemini direct, when the schema is small, every field is always on the page and a wrong value costs little, at a tenth of the price. Velrim, when a value needs a number to sort on and a place on the page to check it, and a blank is cheaper than an invention.