Ask an AI model
create_chat_completionGenerate a reply from an AI model. Use when the app needs generated text. Before: a model id from list_ai_models and enough project balance. Returns the reply message, the tokens used and the amount charged (X-Galon-Charge-USD-Micro). Spends money: billed per token to the project balance at the price shown by get_pricing; the key's spending limit applies. Scope: ai:inference. Cost: paid, reserved on the prepaid balance before the call (released if it fails); prices: get_pricing. Short balance or limit: next_action top_up_balance or raise_app_spend_limit.
Example tool call
This call uses example arguments supplied in the tool’s input schema.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model": "gpt-oss-20b",
"messages": [
{
"role": "user",
"content": "Summarize this order in one sentence."
}
],
"max_tokens": 200,
"idempotency_key": "chat-summary-0001"
},
"name": "create_chat_completion"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | Same seed and input for a repeatable reply. | |
| stop | No | Up to 4 strings that end the reply. | |
| model | Yes | A model id from list_ai_models. | |
| top_p | No | Nucleus sampling, 0 to 1. Change this or temperature. | |
| messages | Yes | The conversation so far, oldest first (1 to 256 messages). | |
| max_tokens | No | Most tokens to generate (1 to 8192). | |
| temperature | No | Randomness, 0 to 2. Lower is more focused. | |
| idempotency_key | Yes | Unique per request; reuse it on retry to get the same reply without paying twice. |