ai_chat
Send a chat completion request to the aeX402 AI Router. Free tier: 3 calls/day. Paid: deducts credits based on token usage.
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": {
"messages": "<messages>"
},
"name": "ai_chat"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Model ID or alias: gpt-4o-mini (default), gpt-4o, claude-sonnet, claude-haiku, llama-70b, llama-8b, gemini-flash | |
| messages | Yes | Chat messages array [{role: "user"|"system"|"assistant", content: "..."}] | |
| max_tokens | No | Maximum tokens to generate (model-dependent default) | |
| temperature | No | Sampling temperature (0-2) | |
| reasoning_effort | No | low | medium | high — ask a reasoning-capable model to think harder. The chain-of-thought comes back in the tool result _meta ("com.aex402/reasoning"). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ||
| model | No | ||
| usage | No | prompt/completion/total tokens | |
| object | No | always 'chat.completion' | |
| choices | Yes | ||
| created | No | unix seconds |