API
Create chat message
POST /chat-messagesCreate a new conversation message or continue an existing dialogue.
Request Body
inputs object
(Optional) Provide user input fields as key-value pairs, corresponding to variables in Prompt Eng. Key is the variable name, Value is the parameter value. If the field type is Select, the submitted Value must be one of the preset choices.
query string
User input/question content
response_mode string
Blocking type, waiting for execution to complete and returning results. (Requests may be interrupted if the process is long)
streaming returns. Implementation of streaming return based on SSE (Server-Sent Events).
conversation_id string
(Optional) Conversation ID: leave empty for first-time conversation; pass conversation_id from context to continue dialogue.
user string
The user identifier, defined by the developer, must ensure uniqueness within the app.
curl --location --request POST 'https://reiki-dev.web3go.xyz/ai/v1/chat-messages' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"inputs": {},
"query": "eh",
"response_mode": "streaming",
"conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276",
"user": "abc-123"
}'blocking
{
"answer": "Hi, is there anything I can help you?",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
"created_at": 1679587005,
"id": "059f87d9-15c0-473a-870c-fde95cdcc1e4"}
streaming
data: {"id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " I", "created_at": 1679586595}
data: {"id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " I", "created_at": 1679586595}Message terminal user feedback, like
POST /messages/{message_id}/feedbacksRate received messages on behalf of end-users with likes or dislikes. This data is visible in the Logs & Annotations page and used for future model fine-tuning.
Path Params
message_id string
Message ID
Request Body
rating string
like or dislike, null is undo
user string
The user identifier, defined by the developer, must ensure uniqueness within the app.
curl --location --request POST \
'https://reiki-dev.web3go.xyz/ai/v1/messages/{message_id}/feedbacks \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"rating": "like",
"user": "abc-123"
}'
{
"has_more": false,
"data": [
{
"id": "WAz8eIbvDR60rouK",
"conversation_id": "xgQQXg3hrtjh7AvZ",
"inputs": {},
"query": "...",
"answer": "...",
"feedback": "like",
"created_at": 692233200
},
{ "id": "hSIhXBhNe8X1d8Et" // ...
}
]
}Get the chat history message
GET /messagesThe first page returns the latest limit bar, which is in reverse order.
Query
conversation_id string
Conversation ID
first_id string
ID of the first chat record on the current page. The default is none.
limit int
How many chats are returned in one request
user string
The user identifier, defined by the developer, must ensure uniqueness within the app.
curl --location --request GET 'https://reiki-dev.web3go.xyz/ai/v1/messages?user=abc-123&conversation_id='\
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'
{
"has_more": false,
"data": [{
"id": "WAz8eIbvDR60rouK",
"username": "FrankMcCallister",
"phone_number": "1-800-759-3000",
"avatar_url": "https://assets.protocol.chat/avatars/frank.jpg",
"display_name": null,
"conversation_id": "xgQQXg3hrtjh7AvZ",
"created_at": 692233200
}, {
"id": "hSIhXBhNe8X1d8Et"
}]
}Get conversation list
GET /conversationsGets the session list of the current user. By default, the last 20 sessions are returned.
Query
last_id string
The ID of the last record on the current page, default none.
limit int
How many chats are returned in one request
user string
The user identifier, defined by the developer, must ensure uniqueness within the app.
curl --location --request GET 'https://reiki-dev.web3go.xyz/ai/v1/conversations?user=abc-123&last_id=&limit=20'
{
"limit": 20,
"has_more": false,
"data": [{
"id": "10799fb8-64f7-4296-bbf7-b42bfbe0ae54",
"name": "New chat",
"inputs": {
"book": "book",
"myName": "Lucy"
},
"status": "normal",
"created_at": 1679667915
}, {
"id": "hSIhXBhNe8X1d8Et"
}]
}Conversation renaming
POST /conversations/{converation_id}/nameRename conversations; the name is displayed in multi-session client interfaces.
Request Body
name string
New name
user string
The user identifier, defined by the developer, must ensure uniqueness within the app.
curl --location --request POST 'https://reiki-dev.web3go.xyz/ai/v1/conversations/name' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "",
"user": "abc-123"
}'
{ "result": "success"}Conversation deletion
DELETE /conversations/{converation_id}Delete conversation.
Request Body
user string
The user identifier, defined by the developer, must ensure uniqueness within the app.
curl --location --request DELETE 'https://reiki-dev.web3go.xyz/ai/v1/conversations/{conversation_id}' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"user": "abc-123"
}'
{ "result": "success"}Last updated