Send a task to the model, get a typed JSON object back. The JSON API in 30 seconds.
Use the JSON API when you have a clear, one-shot task, like parsing a receipt, extracting fields from a document, or classifying a ticket. You give it a name, a short instruction, an input (text, image, audio, PDF, and so on), and the shape of what you want back. You get a typed JSON object.Unlike a chat loop, there’s no message history and no roles. You send a task and get a result.
Over the API the payload sits under data; the SDK exposes it as result.json_payload. The meta field tells you which model ran, how long it took, and what it cost.
When you have more than one piece of input, pass an object. Each key gets passed to the model alongside the instruction.
from pydantic import BaseModelclass Triage(BaseModel): category: str priority: str confidence: floatresult = opper.call( name="classify-ticket", instructions="Pick the best category and priority for the support ticket.", input={ "subject": "Can't reset my password", "body": "I clicked the reset link but the page is broken.", }, output_schema=Triage,)print(result.json_payload)
This is where the JSON API shines. Any input field can be a base64-encoded file. Mark its type in the input_schema and the model reads the file directly, no OCR or pre-processing on your side.Here’s a full invoice parse, line items and all, straight from a PDF:
By default Opper picks the model. To pin one, pass model:
Python
result = opper.call( name="parse-receipt", instructions="Extract the merchant, total, and currency.", input="...", output_schema=Receipt, model="anthropic/claude-sonnet-4-6",)
To say “go fast” or “go cheap” without naming a model, use Hints.