API Reference
Parameters
Parameters
Every option the Generate and Streaming endpoints accept.
Every parameter is optional except a prompt or messages. Leave one out and Aivana uses its default. This page is the canonical definition: the SDKs and the command line expose the same options (Python spells them in snake_case, Node.js in camelCase).
Input
| Parameter | Type | Description |
|---|---|---|
| prompt | string | A single question, up to 200,000 characters. Send this or messages. |
| messages | array | Up to 40 items with a role (system, user or assistant) and content, oldest first. |
| system | string | Your own instructions, such as a persona, tone or format. Aivana's own instructions still apply. |
| attachments | array | Up to 5 files. See Files & Documents. |
Generation
| Parameter | Type | Description |
|---|---|---|
| effort | auto | low | medium | high | A ceiling on how much intelligence Aivana may apply. Default auto: Aivana judges from the request. |
| temperature | number, 0.0–2.0 | Randomness. Left out, Aivana chooses per question. |
| max_tokens | integer, 1–32,000 | A ceiling on answer length. It can shorten an answer, never lengthen it. |
| stop_sequences | array of strings, up to 4 | The answer ends before any of these strings. |
| output_shape | string | The answer format: auto (default) or text for prose, or extract for a JSON answer. summary, recommendation, tradeoffs and decision are also accepted and currently behave like extract. See Structured output. |
| response_format | object | An answer validated against your own JSON Schema: {"type": "json_schema", "schema": {...}}, or {"type": "text"} for an ordinary answer. See Structured Outputs. Not available with streaming, stop_sequences or continue, and not with a non-default output_shape. |
What effort means
Effort is an intelligence ceiling, not a promise about how the request is handled. Low sets a lower reasoning ceiling and can reduce latency on simpler tasks; high allows deeper reasoning for more demanding tasks. Neither guarantees a particular number of models or perspectives; Aivana decides what each request needs within your ceiling. Effort doesn't change the rates you pay: pricing is based on the tokens in your request and response. The Intelligence Trace reports what Aivana actually applied, as intelligence_level.
Structured output
There are two kinds, and they are not the same. Prompt-defined JSON asks for JSON in your prompt and is best effort. JSON Schema (Strict) is checked against a schema you supply, and fails rather than return something that doesn't match. A worked example of each is in Structured Outputs.
Prompt-defined JSON
Set output_shape to extract and the answer is returned as JSON. It is also returned already parsed in the structured field, so your code doesn't have to parse the text. Aivana decides the fields from your prompt, so say which ones you want.
curl https://api.aivana.ai/v1/generate \
-H "X-API-Key: $AIVANA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "From this email, extract the invoice number, date and total as JSON with the keys invoice_number, date and total: ...", "output_shape": "extract"}'{
"answer": "{\"invoice_number\": \"INV-1042\", \"date\": \"2026-09-14\", \"total\": 1280.5}",
"structured": { "invoice_number": "INV-1042", "date": "2026-09-14", "total": 1280.5 },
"structured_error": null
}If the answer isn't a JSON object (for example, it is a list, or isn't valid JSON), structured is null and structured_error says why. The answer field always carries the text, so you never get an empty response and can fall back to it. With text output, structured isn't set.
Prompt-defined JSON is best effort
output_shape gives you JSON shaped by your prompt. Aivana doesn't check it against a schema, so check for the fields you need before relying on them. If you need the structure guaranteed, use JSON Schema (Strict) below. summary, recommendation, tradeoffs and decision are accepted values too, and currently behave the same as extract: they don't yet return fixed fields.
JSON Schema (Strict)
Set response_format to {"type": "json_schema", "schema": {...}} and Aivana returns a response that validates against your schema, or fails. A response that doesn't match is never returned with a 200. On success, structured holds the validated object and answer holds the same value as compact JSON.
The root of your schema must be an object, and every schema in it must say its type. Supported:
| Keyword | Notes |
|---|---|
| type | object, array, string, number, integer, boolean or null. A list of the simple types, such as ["string", "null"], makes a field nullable; a list can't include object or array. |
| properties, required | required may name only properties you declared, each once. |
| additionalProperties | true or false (not a schema). |
| items | Required for an array: one schema for its elements. |
| enum, const | Strings, numbers, booleans or null, matching the declared type. |
| minLength, maxLength | Integers of 0 or more, on strings. |
| minimum, maximum | Numbers, on number and integer. |
| minItems, maxItems | Integers of 0 or more, on arrays. |
| description, title, default, examples, deprecated, readOnly, writeOnly, $comment | Accepted as notes on your schema. They don't change what validates: a default isn't filled in and examples aren't checked. |
| $schema (root only) | JSON Schema 2020-12 or draft-07. |
Not supported: $ref and $defs, oneOf, anyOf, allOf, not, if/then/else, pattern, format, patternProperties, uniqueItems, multipleOf, exclusiveMinimum, exclusiveMaximum, minProperties, maxProperties, and any keyword not listed above. A schema that uses one is refused with a 422 (code invalid_response_schema) before anything runs, rather than being partly honored.
- Limits: a schema can be up to 32 KiB as compact JSON, and nested up to 10 levels deep. The root is level 1; each object property and each array's items go one level deeper.
- output_shape: leave it out, or leave it auto. Any other value beside response_format is refused with a 422, because it would be a second, competing instruction about the shape.
- stop_sequences and continue are refused with a 422 beside a JSON Schema response_format: they would cut or extend the JSON.
- max_tokens still applies. If the cap is too small to hold a valid object, the request fails with structured_output_failed and isn't charged.
- It isn't streamed. Use Generate; POST /v1/generate:stream refuses it with the code structured_output_streaming_not_supported. See Streaming.
- {"type": "text"} is an ordinary answer, the same as output_shape text.
Web search and trace
| Parameter | Type | Description |
|---|---|---|
| web_search | boolean | true searches the web first; false never does. Left out, an API-key request doesn't search. See Web Search. |
| intelligence_trace | boolean | Include the Intelligence Trace, which explains how Aivana handled the request. See Intelligence Trace. |
Notes
- Requests over the size limit are refused with 413. Request bodies can be up to 64 MB (files included); attachment limits are on the Files & Documents page.
- Out-of-range values are refused with a 422 that names the field.
- There is no parameter for choosing a model or provider.
Learn more
Quickstart Guide
Get your key and make your first request in minutes.
Managing API Keys
Learn how to create and revoke API keys in Aivana AI Studio.
Try the Playground
Experiment with Aivana MMI — no account or code required.
Still have questions? We are here to help!