Esquema JSON: extraer una factura española
JSON Schema para extraer una factura española con un LLM: emisor y NIF, número, fecha, líneas, base imponible, IVA y total en euros.
Extrae los datos de la factura. Los importes son números en euros, sin símbolo. Si falta un dato, no lo inventes.
JSON Schema
{
"type": "object",
"required": [
"emisor",
"fecha",
"total"
],
"properties": {
"fecha": {
"type": "string",
"format": "date",
"description": "Fecha de expedición (AAAA-MM-DD)"
},
"total": {
"type": "number"
},
"emisor": {
"type": "string",
"description": "Razón social del emisor"
},
"lineas": {
"type": "array",
"items": {
"type": "object",
"required": [
"concepto",
"importe"
],
"properties": {
"importe": {
"type": "number"
},
"cantidad": {
"type": "number"
},
"concepto": {
"type": "string"
}
}
}
},
"numero": {
"type": "string",
"description": "Número de factura"
},
"tipo_iva": {
"type": "number",
"description": "Porcentaje de IVA (21, 10 o 4)"
},
"cuota_iva": {
"type": "number"
},
"nif_emisor": {
"type": "string",
"description": "NIF o CIF del emisor"
},
"base_imponible": {
"type": "number"
}
}
}Beispielausgabe
{
"emisor": "Imprenta Gómez S.L.",
"nif_emisor": "B12345678",
"numero": "F-2026-0412",
"fecha": "2026-09-15",
"lineas": [
{
"concepto": "Tarjetas de visita x500",
"cantidad": 1,
"importe": 80.0
},
{
"concepto": "Folletos A5 x1000",
"cantidad": 1,
"importe": 120.0
}
],
"base_imponible": 200.0,
"tipo_iva": 21,
"cuota_iva": 42.0,
"total": 242.0
}Geschätzte Kosten
Eingabe-Tokens pro Aufruf : ≈ 610
| Modell | Pro Aufruf | Pro 1.000 Aufrufe |
|---|---|---|
| Mistral Large · Mistral AI | 0,00027 € | 0,27 € |
| DeepSeek Flash · DeepSeek | 0,00016 € | 0,16 € |
| DeepSeek V4 Pro · DeepSeek | 0,00071 € | 0,71 € |
| GPT-6 Luna · OpenAI | 0,00005 € | 0,05 € |
| GPT-6 Sol · OpenAI | 0,00107 € | 1,07 € |
| Claude Sonnet 5.5 · Anthropic | 0,00107 € | 1,07 € |
| Claude Opus 5.5 · Anthropic | 0,00215 € | 2,15 € |
| 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--extraer-factura-espanola
- Typ
- Ausgabeschemas
- Datei
- extraer-factura-espanola.schema.json
- Format
- JSON (application/json)
- Größe
- 1.163 Bytes (1,1 KB)
- Kodierung
- UTF-8
- Geschätzte Tokens
- ≈ 322
- Sprache
- Spanisch
- Lizenz
- MIT
- Kommerzielle Nutzung
- Erlaubt
- Personenbezogene Daten
- Keine
- Version
- 1.0
- Veröffentlicht am
- 3. Oktober 2026 um 05:20
- Aktualisiert am
- 3. Oktober 2026 um 05:20
- Speicherung
- in der Datenbank
- Nutzungen
- 0
- Gefällt mir
- 0
extraer-factura-espanola.schema.json
{
"type": "object",
"required": [
"emisor",
"fecha",
"total"
],
"properties": {
"fecha": {
"type": "string",
"format": "date",
"description": "Fecha de expedición (AAAA-MM-DD)"
},
"total": {
"type": "number"
},
"emisor": {
"type": "string",
"description": "Razón social del emisor"
},
"lineas": {
"type": "array",
"items": {
"type": "object",
"required": [
"concepto",
"importe"
],
"properties": {
"importe": {
"type": "number"
},
"cantidad": {
"type": "number"
},
"concepto": {
"type": "string"
}
}
}
},
"numero": {
"type": "string",
"description": "Número de factura"
},
"tipo_iva": {
"type": "number",
"description": "Porcentaje de IVA (21, 10 o 4)"
},
"cuota_iva": {
"type": "number"
},
"nif_emisor": {
"type": "string",
"description": "NIF o CIF del emisor"
},
"base_imponible": {
"type": "number"
}
}
}Anthropic-API (Python)
import json, anthropic
schema = json.load(open("extraer-factura-espanola.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": "extraer-factura-espanola",
"schema": {
"type": "object",
"required": [
"emisor",
"fecha",
"total"
],
"properties": {
"fecha": {
"type": "string",
"format": "date",
"description": "Fecha de expedición (AAAA-MM-DD)"
},
"total": {
"type": "number"
},
"emisor": {
"type": "string",
"description": "Razón social del emisor"
},
"lineas": {
"type": "array",
"items": {
"type": "object",
"required": [
"concepto",
"importe"
],
"properties": {
"importe": {
"type": "number"
},
"cantidad": {
"type": "number"
},
"concepto": {
"type": "string"
}
}
}
},
"numero": {
"type": "string",
"description": "Número de factura"
},
"tipo_iva": {
"type": "number",
"description": "Porcentaje de IVA (21, 10 o 4)"
},
"cuota_iva": {
"type": "number"
},
"nif_emisor": {
"type": "string",
"description": "NIF o CIF del emisor"
},
"base_imponible": {
"type": "number"
}
}
},
"strict": true
}
}
Community
Noch keine Kommentare. Teile deine Erfahrung, sie hilft den Nächsten.