openclaw_chat_completion
Send a user message to an OpenClaw instance and receive the assistant's reply via an OpenAI-compatible API. Supports multi-turn conversations and streaming.
Instructions
Send a chat completion request to an OpenClaw instance via the OpenAI-compatible API. Returns the assistant's response text.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instance_ip | Yes | IP address or hostname of the OpenClaw instance (e.g., 167.71.242.214). Do not include https:// prefix. | |
| auth_token | Yes | Bearer token for authenticating with the OpenClaw Gateway. | |
| message | No | The user message to send. For multi-turn conversations, use 'Messages JSON' instead or in addition. | |
| messages_json | No | Optional JSON array of prior messages for multi-turn conversations. Format: [{"role":"user","content":"hi"},{"role":"assistant","content":"hello"}]. If 'Message' is also provided, it is appended as the latest user turn. | |
| model | No | Model identifier. Format: 'openclaw:<agentId>' or 'agent:<agentId>'. Default: openclaw:main. | openclaw:main |
| agent_id | No | OpenClaw agent ID sent via x-openclaw-agent-id header. Default: main. | main |
| session_key | No | Optional session key for conversation continuity. Requests with the same session key share the same agent session on the OpenClaw instance. | |
| stream | No | Use Server-Sent Events (SSE) streaming for the response. | |
| timeout | No | Request timeout in seconds. Default: 120. | 120 |
| output_variable_name | Yes | Variable name for the result. Access response with {{openclaw_result.response_text}}. | openclaw_result |