Skip to main content
POST
/
action
/
openclaw_chat_completion
OpenClaw Chat Completion
curl --request POST \
  --url https://api-lr.agent.ai/v1/action/openclaw_chat_completion \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "instance_ip": "<string>",
  "auth_token": "<string>",
  "output_variable_name": "openclaw_result",
  "message": "<string>",
  "messages_json": "<string>",
  "model": "openclaw:main",
  "agent_id": "main",
  "session_key": "<string>",
  "stream": false,
  "timeout": "120"
}
'
{
  "status": 123,
  "response": {}
}

Authorizations

Authorization
string
header
required

Bearer token from your account (https://agent.ai/user/integrations#api)

Body

application/json
instance_ip
string
required

IP address or hostname of the OpenClaw instance (e.g., 167.71.242.214). Do not include https:// prefix.

auth_token
string
required

Bearer token for authenticating with the OpenClaw Gateway.

output_variable_name
string
default:openclaw_result
required

Variable name for the result. Access response with {{openclaw_result.response_text}}.

Pattern: ^[a-zA-Z][a-zA-Z0-9_]*$
message
string

The user message to send. For multi-turn conversations, use 'Messages JSON' instead or in addition.

messages_json
string

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
string
default:openclaw:main

Model identifier. Format: 'openclaw:' or 'agent:'. Default: openclaw:main.

agent_id
string
default:main

OpenClaw agent ID sent via x-openclaw-agent-id header. Default: main.

session_key
string

Optional session key for conversation continuity. Requests with the same session key share the same agent session on the OpenClaw instance.

stream
boolean
default:false

Use Server-Sent Events (SSE) streaming for the response.

timeout
string
default:120

Request timeout in seconds. Default: 120.

Response

Successful response

status
integer<int32>

HTTP status code of the action response

response
object

Response data from the action