JSON schema: extract a U.S. invoice
JSON Schema to extract a U.S. invoice with an LLM: vendor, invoice number, dates, line items, subtotal, sales tax and total in USD.
Extract the invoice data. Amounts are plain numbers in U.S. dollars, without the $ sign. If a field is missing, leave it out: never invent it.
JSON Schema
{
"type": "object",
"required": [
"vendor",
"invoice_date",
"total"
],
"properties": {
"total": {
"type": "number"
},
"vendor": {
"type": "string",
"description": "Legal name of the vendor"
},
"currency": {
"enum": [
"USD"
],
"type": "string"
},
"due_date": {
"type": "string",
"format": "date"
},
"subtotal": {
"type": "number"
},
"sales_tax": {
"type": "number",
"description": "Sales tax amount, 0 if none"
},
"line_items": {
"type": "array",
"items": {
"type": "object",
"required": [
"description",
"amount"
],
"properties": {
"amount": {
"type": "number"
},
"quantity": {
"type": "number"
},
"unit_price": {
"type": "number"
},
"description": {
"type": "string"
}
}
}
},
"invoice_date": {
"type": "string",
"format": "date",
"description": "Issue date (YYYY-MM-DD)"
},
"invoice_number": {
"type": "string"
}
}
}Beispielausgabe
{
"vendor": "Bright Print Co.",
"invoice_number": "INV-2026-0412",
"invoice_date": "2026-09-15",
"due_date": "2026-10-15",
"line_items": [
{
"description": "Business cards x500",
"quantity": 1,
"unit_price": 80.0,
"amount": 80.0
},
{
"description": "Flyers 5.5x8.5 x1000",
"quantity": 1,
"unit_price": 120.0,
"amount": 120.0
}
],
"subtotal": 200.0,
"sales_tax": 17.25,
"total": 217.25,
"currency": "USD"
}Geschätzte Kosten
Eingabe-Tokens pro Aufruf : ≈ 656
| Modell | Pro Aufruf | Pro 1.000 Aufrufe |
|---|---|---|
| Mistral Large · Mistral AI | 0,00029 € | 0,29 € |
| DeepSeek Flash · DeepSeek | 0,00017 € | 0,17 € |
| DeepSeek V4 Pro · DeepSeek | 0,00076 € | 0,76 € |
| GPT-6 Luna · OpenAI | 0,00006 € | 0,06 € |
| GPT-6 Sol · OpenAI | 0,00116 € | 1,16 € |
| Claude Sonnet 5.5 · Anthropic | 0,00116 € | 1,16 € |
| Claude Opus 5.5 · Anthropic | 0,00231 € | 2,31 € |
| Selbst gehostetes Open-Source-Modell (Ollama, vLLM) | 0 € API-Kosten (nur Serverkosten) | |
Nur Eingabekosten, ohne die Antwort des Modells. Öffentliche Standardpreise der Anbieter (Mistral AI, DeepSeek, OpenAI, Anthropic) von USD in Euro umgerechnet zum EZB-Kurs vom 29. September 2026. Schätzung: 1 Token ≈ 3,6 Zeichen.
Common to all 3 regions
Created by the author, no outside source.
Commercial use allowed · credit the author · changes allowed.
Text or data only: no access to files, network or commands.
Hosted in France (Scaleway, Paris). No transfer outside the EU.
European Union · 5/5
No personal data.
No training data: no summary required.
United States · 5/5
No personal data.
No training data: no documentation to publish.
China · 5/5
No personal data.
No training data; AI-generated content published in China must be labelled (2025).
Indicative summary as of 30/09/2026, not a legal certification. Method and sources →
Statistiken
Gefällt mir : 0 · Kommentare : 0
Klicken Sie auf einen Zähler, um ihn ein- oder auszublenden; fahren Sie über das Diagramm für Details. Ein Aufruf pro Besucher und Tag, ohne Bots; Zählung seit dem 30. September 2026.
- Kennung
- contextetech--extract-us-invoice
- Typ
- Ausgabeschemas
- Datei
- extract-us-invoice.schema.json
- Format
- JSON (application/json)
- Größe
- 1.215 Bytes (1,2 KB)
- Kodierung
- UTF-8
- Geschätzte Tokens
- ≈ 338
- Sprache
- Englisch
- Lizenz
- MIT
- Kommerzielle Nutzung
- Erlaubt
- Personenbezogene Daten
- Keine
- Version
- 1.0
- Veröffentlicht am
- 2. Oktober 2026 um 21:54
- Aktualisiert am
- 2. Oktober 2026 um 21:54
- Speicherung
- in der Datenbank
- Nutzungen
- 0
- Gefällt mir
- 0
extract-us-invoice.schema.json
{
"type": "object",
"required": [
"vendor",
"invoice_date",
"total"
],
"properties": {
"total": {
"type": "number"
},
"vendor": {
"type": "string",
"description": "Legal name of the vendor"
},
"currency": {
"enum": [
"USD"
],
"type": "string"
},
"due_date": {
"type": "string",
"format": "date"
},
"subtotal": {
"type": "number"
},
"sales_tax": {
"type": "number",
"description": "Sales tax amount, 0 if none"
},
"line_items": {
"type": "array",
"items": {
"type": "object",
"required": [
"description",
"amount"
],
"properties": {
"amount": {
"type": "number"
},
"quantity": {
"type": "number"
},
"unit_price": {
"type": "number"
},
"description": {
"type": "string"
}
}
}
},
"invoice_date": {
"type": "string",
"format": "date",
"description": "Issue date (YYYY-MM-DD)"
},
"invoice_number": {
"type": "string"
}
}
}Anthropic-API (Python)
import json, anthropic
schema = json.load(open("extract-us-invoice.schema.json"))
client = anthropic.Anthropic()
resp = client.messages.create(model="claude-sonnet-5", max_tokens=1024,
tools=[{"name": "extraire", "description": "Renvoie les données extraites", "input_schema": schema}],
tool_choice={"type": "tool", "name": "extraire"},
messages=[{"role": "user", "content": "deine Eingabe hier"}])
print(resp.content[0].input)OpenAI-Format (response_format)
{
"type": "json_schema",
"json_schema": {
"name": "extract-us-invoice",
"schema": {
"type": "object",
"required": [
"vendor",
"invoice_date",
"total"
],
"properties": {
"total": {
"type": "number"
},
"vendor": {
"type": "string",
"description": "Legal name of the vendor"
},
"currency": {
"enum": [
"USD"
],
"type": "string"
},
"due_date": {
"type": "string",
"format": "date"
},
"subtotal": {
"type": "number"
},
"sales_tax": {
"type": "number",
"description": "Sales tax amount, 0 if none"
},
"line_items": {
"type": "array",
"items": {
"type": "object",
"required": [
"description",
"amount"
],
"properties": {
"amount": {
"type": "number"
},
"quantity": {
"type": "number"
},
"unit_price": {
"type": "number"
},
"description": {
"type": "string"
}
}
}
},
"invoice_date": {
"type": "string",
"format": "date",
"description": "Issue date (YYYY-MM-DD)"
},
"invoice_number": {
"type": "string"
}
}
},
"strict": true
}
}
Community
Noch keine Kommentare. Teile deine Erfahrung, sie hilft den Nächsten.