chat
Send messages to any supported model ID and get the answer with token usage and request cost, using one API key for OpenAI and Anthropic models.
Instructions
Send a conversation to any chat model id and return the answer with the token usage and the cost of the request. Needs UPLINKSWITCH_API_KEY in the environment. OpenAI and Anthropic models both work on the same key and base URL.
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>",
"messages": "<messages>"
},
"name": "chat"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | A chat model id from list_models | |
| messages | Yes | The conversation, oldest first | |
| max_tokens | No | Cap on the reply length | |
| temperature | No | Sampling temperature |