Best Model for This
Costs assume ~400 tokens input + ~200 tokens output per extraction, at today’s published prices. All three are in the free tier.
Quick Start
Tips & Best Practices
- Always set
temperature=0— extraction is deterministic, not creative. Higher temperatures introduce variation in field names and values. - Always validate output — use Pydantic or Zod. Models occasionally miss optional fields or format dates differently.
- Provide examples in the system prompt — one example of input + expected output dramatically improves accuracy on complex schemas.
- Use
response_format: json_object— the model is asked for JSON, which usually prevents markdown wrapping or prose before the JSON. Nothing validates it, so still parse inside atryand check the fields.
Cost Estimate
Assumes ~400 tokens input + ~200 tokens output per extraction. Token count scales with document length.
Next Steps
- Structured Outputs — enforced JSON schema reference
- Error Handling — handle malformed JSON and retries
- Prompt Caching — cache the system prompt when processing batches