Build a research, bulk-summary or structured-summary flow
Section: DOC-MA-model-controls-examples#model-routing-recipes.
Choose a model filter for the task, then inspect the accepted run and its result. Replace sample model IDs with models supported for your account, and use a thread ID returned by create-thread. See authentication for the credential pair.
These are three separate recipes. Choose one for the workload instead of applying every filter to every request. Each begins with controlled input and finishes by checking the accepted run and the answer your application will consume.
Recipe: keep a research conversation on large-context candidates
Section: DOC-MA-model-controls-examples#long-context-thread.
Use this for a user working through a long set of notes. Before starting, prepare the permitted notes, user-scoped credentials and account-supported candidates with suitable context capacity. The request creates the research thread; it does not send the notes yet.
Filter the fallback candidates using their known context-window metadata:
curl -X POST https://api.travila.ai/api/v1/llm/create-thread \
-H "X-API-Key: $API_KEY" \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{
"title": "Long research thread",
"defaultGenerationConfig": {
"models": [
"google/gemini-3.6-flash:nitro",
"anthropic/claude-sonnet-4.6:nitro",
"anthropic/claude-sonnet-5"
],
"modelRoutingFilter": {
"minContextLength": 128000
}
}
}'
Reference: Create a new conversation thread · Request fields.
If any model in the models list has less than 128k context, it's silently removed. If all are removed, send-message returns an immediate error.
Keep the returned thread ID, then send the user's first notes and question through generation. Follow that run to its answer. Continue with the same thread for follow-ups and use context management as history grows.
Finished result: the research thread has the intended candidate filter and a correlated answer to the supplied notes. If no candidate survives, correct the selection; do not assume the thread can accept unlimited context.
Recipe: summarize support notes with a catalog price filter
Section: DOC-MA-model-controls-examples#price-filtered-generation.
Use this for a batch of short support notes. Start with one note in a created thread and replace bulk-task-001 with that ID. Set thresholds consistent with your permitted candidates and inspect actual usage before increasing volume.
These fields compare catalog price per token, not total spend. Unknown prices can pass; use separately enforced budgets for a spending ceiling.
For a bulk task, remove models whose known catalog prices exceed these example thresholds:
curl -X POST https://api.travila.ai/api/v1/llm/send-message \
-H "X-API-Key: $API_KEY" \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{
"conversationKey": "bulk-task-001",
"userMessage": {
"role": "ROLE_USER",
"content": [
{
"type": "CONTENT_PART_TYPE_TEXT",
"content": "Summarize this support note: The customer reset their password and can now sign in."
}
]
},
"overrideGenerationConfig": {
"models": [
"google/gemini-3.6-flash:nitro",
"google/gemini-3.1-flash-lite",
"google/gemini-3-flash-preview"
],
"modelRoutingFilter": {
"maxPromptCost": 0.000005,
"maxCompletionCost": 0.00002
}
}
}'
Reference: Send a message to a conversation · Request fields.
Retain the accepted run ID, read its correlated reply and check the summary against the supplied note. Inspect measured usage and missing counters separately; known catalog price filters do not calculate the total charge.
Finished result: one note has a checked summary and an understood outcome. Increase the workload only after that flow works and the account's actual spending controls meet your needs.
Recipe: return a task summary after tool-assisted work
Section: DOC-MA-model-controls-examples#structured-output-with-tool-support.
Use a conversation that already contains the task and any completed tool results. Select and authorize the required tools separately, finish their calls, then ask for a summary object. Wait until the prior turn is resolved before using this per-send override; queued sends do not retain it.
Require catalog support for both tools and a structured response. This example requests a task summary; it does not attach any tools by itself:
curl -X POST https://api.travila.ai/api/v1/llm/send-message \
-H "X-API-Key: $API_KEY" \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{
"conversationKey": "<your-thread-id>",
"userMessage": {
"role": "ROLE_USER",
"content": [
{
"type": "CONTENT_PART_TYPE_TEXT",
"content": "Summarize the task we just discussed."
}
]
},
"overrideGenerationConfig": {
"models": [
"google/gemini-3.6-flash:nitro",
"anthropic/claude-sonnet-4.6:nitro"
],
"responseFormat": {
"jsonSchema": {
"type": "object",
"properties": {
"summary": {
"type": "string"
}
},
"required": [
"summary"
],
"additionalProperties": false
},
"schemaName": "task_summary",
"validate": true
},
"modelRoutingFilter": {
"requiredParameters": [
"tools",
"response_format"
]
}
}
}'
Reference: Send a message to a conversation · Request fields.
After the run completes, parse and validate its final answer against the same schema before displaying or using it. A valid summary string can still be inaccurate, so inspect the content before taking an action. See structured answers for incomplete, refused and repaired results.
Finished result: the application receives a completed object with a summary string that passes the same schema and accurately reflects the task. A capability filter does not attach tools, and a typed result does not authorize another action.
Document ID: DOC-MA-model-controls-examples. Section identities and revisions.