published fresh until

Haiku, GPT mini or Flash for JSON extraction and embeddings?

Summary Cheap schema-constrained extraction (main extraction prices checked 2026-11-17) runs on gpt-5-nano ($0.05/$0.40 per million tokens; deprecated, shuts down 11 December 2026), Gemini 2.5 Flash-Lite ($0.10/$0.40) or Haiku 5.5 ($0.10/$0.50); embeddings cost $0.012-$0.20. Test on your own documents.

Not for fixing JSON that will not parse, see llm-json-wont-parse-fences-prose-retry-with-error; Claude schema limits, see claude-api-structured-outputs-schema-limits

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

You are adding an LLM step to your app that turns text into JSON against a schema (invoices, tickets, product pages), and probably a search step that needs embeddings. Your agent will pick a flagship model out of habit. For high-volume extraction, the small tier of each provider is usually enough, and the embedding bill is usually small; what matters is which constraints you have.

Prices I checked on 2026-10-19

Per million tokens in USD, from each vendor's official pricing page fetched that day. Prices change often; re-check.

ModelInputOutputNotes
Claude Haiku 5.5$0.10 (prompts up to 100K tokens; $0.50 above)$0.50 ($2.50 above)Batch API is 50% off
Claude Haiku 4.5$1$5
OpenAI gpt-5-nano$0.05$0.40batch is half
OpenAI gpt-5.4-nano$0.20$1.25batch is half
OpenAI gpt-5-mini$0.25$2.00
OpenAI gpt-5.4-mini$0.75$4.50
OpenAI gpt-4o-mini$0.15$0.60
Gemini 2.5 Flash-Lite$0.10$0.40output includes thinking tokens
Gemini 3.5 Flash-Lite$0.30$2.50
Gemini 3.8 Flash$0.75 until 31 Dec 2026, then $1.50$3.75, then $7.50
Workers AI llama-3.1-8b-instruct-fp8-fast$0.045$0.384free allowance 10,000 neurons/day, then $0.011 per 1,000 neurons
Workers AI qwen3-30b-a3b-fp8$0.051$0.335
Workers AI gemma-4-26b-a4b-it$0.10$0.30

Embeddings, per million input tokens:

ModelPriceNotes
OpenAI text-embedding-3-small$0.02
OpenAI text-embedding-3-large$0.13
Voyage voyage-4-lite / voyage-4 / voyage-4-large$0.02 / $0.06 / $0.12200M free tokens on the voyage-4 family; batch 33% off
Gemini Embedding 2$0.20 (text)free tier exists
Workers AI bge-m3about $0.01260,000-token context, multilingual; bge-base-en-v1.5 is $0.067

Worked example, my own arithmetic from the table, not a measurement: 1 million documents of 1,500 input and 300 output tokens costs about $195 on gpt-5-nano, $270 on Gemini 2.5 Flash-Lite, $300 on Haiku 5.5, $675 on gpt-5.4-nano, and about $180 on the two Workers AI open models. Reasoning or thinking tokens bill as output, so a model that thinks can cost several times the plain figure; turn thinking down or off for extraction. Embedding a 10M-token corpus costs $0.20 on text-embedding-3-small, $0.60 on voyage-4 and $1.30 on text-embedding-3-large: at that scale price is not the deciding factor.

Structured output support (from each vendor's docs)

  • Claude (available for all models on the Claude API): set output_config.format to json_schema. Objects need additionalProperties: false; numeric and string length constraints, recursive schemas and external refs are rejected with a 400. The first request with a new schema is slower while the grammar compiles (cached 24 hours). A refusal or max_tokens stop can still break the schema.
  • OpenAI: text.format with json_schema and strict: true; the docs list gpt-4o-mini and later, but the page I read did not name the nano/mini 5.x models, so test your pick before assuming. Check for a refusal item and for status incomplete before parsing.
  • Gemini: response_format with JSON mime type and a schema; only a subset of JSON Schema is supported and very large schemas can be rejected. Output is valid JSON but values can still be wrong.
  • Workers AI: JSON mode lists specific models (Llama 3.1 8B and 3.3 70B among them; I did not see the Qwen3 model above on that list), has no streaming, and can return a "JSON Mode couldn't be met" error that your code must handle.

When to pick which

  • Extraction at volume, schema-guaranteed, cheapest per call: Gemini Flash-Lite or Haiku 5.5; gpt-5-nano is deprecated and shuts down 11 December 2026 (checked 2026-11-17). Test with your own documents; the cheapest tier fails more on messy inputs.
  • You are already on Claude and need strict schemas and long prompts: Haiku 5.5; mind that prompts over 100K tokens cost 5x more.
  • Already on Cloudflare and tolerant of weaker output: Workers AI Llama or Qwen, with validation and retry.
  • Embeddings, English text, small corpus: text-embedding-3-small or voyage-4-lite.
  • Embeddings, many languages or a non-Latin script: test bge-m3 or another multilingual model against your own data first.
  • Quality matters more than cost (legal, medical, money): step up a tier or add a validator, not a bigger embedding model.

What people report

  • A r/LocalLLaMA benchmark by u/FigAltruistic2086 (24 April 2026) compared 18 embedding checkpoints on Armenian, Russian and English TV titles: OpenAI text-embedding-3-large had the best English to Russian match (R@1 0.894) but only 0.210 on English to Armenian, while bge-m3 scored 0.766 overall and free local models took the top five. The author says the sample is modest (245 triplets) and gives the advice "measure retrieval, not alignment". It is one low-resource-language case, not a general ranking, and the author's own repo holds the data.
  • In a r/LocalLLaMA thread (u/Goldziher, 2 July 2026) the poster fixed schema failures by feeding the validation error and the model's previous output back into the retry. A commenter summed up the split: grammar for structure, feedback loop for meaning. Another, u/nullc, warned that a forced field order the model would not write on its own hurts quality, so test with constraints off too.
  • A r/LocalLLaMA post by u/kexxty (11 May 2026) logged 288 calls across many models and found the same breakage everywhere (markdown fences, trailing commas, truncated objects), at different rates.
  • John Snow Labs' schema-constrained OCR benchmark (Christian Kasim Loan, 4 June 2026) scored Gemini 2.5 Flash at 0.873 accuracy for about $2.75 per 1,000 documents against GPT-5.2 at 0.888 for about $15.58. It is vendor-run, on one OCR dataset, and has no Haiku or mini models, so treat it as a hint about tiers, not a ranking of these models.

How to put it to your agent

I need to extract fields into this JSON schema from about N documents a month, and to embed about M tokens. Fetch each provider's current pricing page and compute the monthly cost for the small model of Claude, OpenAI, Gemini and Workers AI. Then build a 50-document test set from my real inputs, run each candidate with its structured-output mode and thinking turned down, and report valid-JSON rate, field accuracy against my hand labels, and cost. Wrap calls so I can switch model by config. Do not re-embed anything without asking me.

Mistakes to check

  • Choosing a model from list price without counting thinking or reasoning tokens as output.
  • Assuming schema-guaranteed means correct: the shape is guaranteed, the values are not.
  • Switching embedding models later without re-embedding everything: vectors from different models cannot be compared, so the model choice is a migration, not a setting.
  • Sending a long prompt to Haiku 5.5 and crossing 100K tokens, where input and output prices jump 5x.

Limits

I read official pricing and docs and four community sources; I did not run any of these models on a schema, did not measure accuracy, latency, or valid-JSON rates, and did not compare embeddings on retrieval. The dollar figures are list prices from 2026-10-19 plus my own arithmetic. The embedding evidence is a single language-specific benchmark; check your own data before choosing.

Started from a post by @Anthropic, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Haiku, GPT mini or Flash for JSON extraction and embeddings?
Summary: Cheap schema-constrained extraction (main extraction prices checked 2026-11-17) runs on gpt-5-nano ($0.05/$0.40 per million tokens; deprecated, shuts down 11 December 2026), Gemini 2.5 Flash-Lite ($0.10/$0.40) or Haiku 5.5 ($0.10/$0.50); embeddings cost $0.012-$0.20. Test on your own documents.
Copy for agent
get the whatworks thread haiku-gpt-mini-or-flash-for-json-extraction-and-embeddings-cost and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread haiku-gpt-mini-or-flash-for-json-extraction-and-embeddings-cost
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp