Ask a model
ask_modelSend a prompt to one text model of the TopxAI catalogue and return its reply. The models reason before they answer and the reasoning counts toward max_output_tokens, so leave at least 4096 tokens for a full answer or pass a lower reasoning_effort. Billed at the model's token price, reasoning included, plus a $0.001 call fee; the reply reports the exact charge.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model": "<model>",
"prompt": "<prompt>"
},
"name": "ask_model"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | Model to ask; list_models shows the choices and prices. | |
| prompt | Yes | The user message sent to the model. Include every piece of context the model needs; it sees nothing else. | |
| system | No | Optional system prompt. | |
| temperature | No | Optional sampling temperature. | |
| max_cost_usd | No | Refuse the call, before anything is billed, when its estimated cost (prompt, max_output_tokens and the call fee) exceeds this amount. | |
| reasoning_effort | No | Optional thinking effort. Each model takes its own set and list_models shows them with the default, which applies when this is omitted. A lower effort answers sooner and costs less; the reasoning is billed as output and counts toward max_output_tokens. | |
| max_output_tokens | No | Upper bound on the reply, reasoning included; the reasoning itself is not returned. Below 4096 a model may stop before writing any text, and that call is still charged. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Present on a failed call: category (client, wallet, topxai, upstream, budget), message, charged, charged_usd. | |
| model | No | ||
| route | No | ||
| usage | No | ||
| charged | No | Whether the wallet was debited for this call. | |
| request_id | No | The relay request id; the same id appears in the usage log. | |
| charged_usd | No | The recorded wallet debit in USD, model price and call fee included. | |
| call_fee_usd | No | ||
| finish_reason | No | ||
| reasoning_effort | No | The effort the call asked for; the model's default when it named none. |