Chat Completion
chat_completionSend prompts to OpenRouter's AI models to generate chat completions, with controls for model choice, fallbacks, and sampling parameters.
Instructions
Generate a chat completion using an OpenRouter model
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": {
"prompt": "<prompt>"
},
"name": "chat_completion"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | The primary model to use (e.g., 'anthropic/claude-sonnet-4.6'). Defaults to 'openrouter/auto'. | openrouter/auto |
| models | No | An optional list of fallback models to try in order if the primary model fails. | |
| prompt | Yes | The prompt to send to the model | |
| max_tokens | No | Maximum tokens to generate | |
| temperature | No | Sampling temperature (0-2) | |
| system_prompt | No | Optional system prompt |