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.Documentation Index
Fetch the complete documentation index at: https://docs.opper.ai/llms.txt
Use this file to discover all available pages before exploring further.
Your first call
Here we parse a receipt. The instruction says what to do, the input is the receipt text, and theoutput_schema describes the JSON we want back.
Response
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.
Multiple input fields
When you have more than one piece of input, pass an object. Each key gets passed to the model alongside the instruction.Response
Parse a PDF, image, or audio file
This is where the JSON API shines. Any input field can be a base64-encoded file. Mark its type in theinput_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:
Python
result.json_payload comes back as a dict with the invoice fields, nested line items included:
application/pdf for image/jpeg, audio/wav, or any other supported type. Schemas has the full media-type list.
Pick a specific model
By default Opper picks the model. To pin one, passmodel:
Python
Why the name matters
Thename (like parse-receipt or classify-ticket) identifies the task. It does two things:
- Labels the call on its trace, so you can see what each call was for.
- Acts as a cache key, so reusing the same name makes repeat calls of the same task faster.
Request fields
A short identifier for what this call does. Use the same name for the same task across your app.
What the model should do. Plain English. Keep it short.
What you want it done with. Can be a string or an object with any fields, including base64 media.
Optional. Validates the shape of
input before it goes to the model, and lets you mark fields as images, PDFs, or audio.Optional but recommended. Tells the model exactly what JSON to return, and validates it.
Optional. Pin a model, e.g.
openai/gpt-5-mini. If omitted, Opper picks one.What’s next
Schemas
Pydantic, Zod, raw JSON Schema, and media types in depth.
Streaming
See fields arrive one at a time as the model generates them.
Hints
Optimize for cost, speed, or quality without picking a model.
Control Plane
Govern, score, and improve every call.