Send a chat request
chatSends messages to any chat model id through POST /v1/chat/completions and returns the answer, the token usage and what the request cost. system adds instructions, image_urls lets a model that sees images look at them (a file generate made works), web_search lets the model search while it answers. Billed to the key in the MCP request's Authorization header (Bearer sk-relay-live-...); without one it fails.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | A chat model id from list_models. | |
| system | No | Instructions placed ahead of the conversation as a system message. | |
| messages | Yes | The conversation, OpenAI chat format. | |
| image_urls | No | Image URLs attached to the last user message, for the chat models that take images (input_modalities in list_models). A file generate made works. | |
| max_tokens | No | Cap on completion tokens. | |
| web_search | No | True: the model may search the web while it answers (billed per search, the price in GET /v1/catalog server_tools). | |
| temperature | No |