v1
latestOpenAPI 3.1.02026-07-13570316.1 KBAI
Chat
Thirdweb AI chat completion API (BETA).
Send natural language queries to interact with any EVM chain, read data, prepare transactions, swap tokens, deploy contracts, payments and more.
Compatible with standard OpenAI API chat completion format, can be used raw or with any popular AI library.
Authentication: Pass x-client-id header for frontend usage from allowlisted origins or x-secret-key for backend usage.
post/ai/chat
Request body
Example request
{
"messages": [
{
"role": "user",
"content": "Send 0.01 ETH to vitalik.eth"
}
],
"context": {
"chain_ids": [
8453
],
"from": "0x1234567890123456789012345678901234567890"
},
"stream": false
}Response
AI assistant response or SSE stream when stream=true
Example response
{
"message": "I've prepared a native ETH transfer as requested. Would you like to proceed with executing this transfer?",
"session_id": "123",
"request_id": "456",
"actions": [
{
"type": "sign_transaction",
"data": {
"chain_id": 8453,
"to": "0x1234567890123456789012345678901234567890",
"value": "10000000000000000",
"data": "0x"
},
"session_id": "123",
"request_id": "456",
"source": "model"
}
]
}