Skip to main content
POST
/
{blueprint_instance_id}
/
chat
/
stream
Python (SDK)
from meibelai import Meibelai
import os


with Meibelai(
    api_key_header=os.getenv("MEIBELAI_API_KEY_HEADER", ""),
) as m_client:

    res = m_client.blueprints.executions.send_chat_message_stream(blueprint_instance_id="<id>", user_message="<value>", timeout_seconds=None, include_thinking=False, include_tool_activity=True)

    with res as event_stream:
        for event in event_stream:
            # handle event
            print(event, flush=True)
curl --request POST \
  --url https://api.meibel.ai/v1/{blueprint_instance_id}/chat/stream \
  --header 'Content-Type: application/json' \
  --header 'Meibel-API-Key: <api-key>' \
  --data '
{
  "user_message": "<string>",
  "timeout_seconds": 123,
  "include_thinking": true,
  "include_tool_activity": true
}
'
const options = {
  method: 'POST',
  headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    user_message: '<string>',
    timeout_seconds: 123,
    include_thinking: true,
    include_tool_activity: true
  })
};

fetch('https://api.meibel.ai/v1/{blueprint_instance_id}/chat/stream', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.meibel.ai/v1/{blueprint_instance_id}/chat/stream",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'user_message' => '<string>',
    'timeout_seconds' => 123,
    'include_thinking' => true,
    'include_tool_activity' => true
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "Meibel-API-Key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.meibel.ai/v1/{blueprint_instance_id}/chat/stream"

	payload := strings.NewReader("{\n  \"user_message\": \"<string>\",\n  \"timeout_seconds\": 123,\n  \"include_thinking\": true,\n  \"include_tool_activity\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Meibel-API-Key", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.meibel.ai/v1/{blueprint_instance_id}/chat/stream")
  .header("Meibel-API-Key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"user_message\": \"<string>\",\n  \"timeout_seconds\": 123,\n  \"include_thinking\": true,\n  \"include_tool_activity\": true\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.meibel.ai/v1/{blueprint_instance_id}/chat/stream")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Meibel-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"user_message\": \"<string>\",\n  \"timeout_seconds\": 123,\n  \"include_thinking\": true,\n  \"include_tool_activity\": true\n}"

response = http.request(request)
puts response.read_body
{
  "event": "<string>",
  "data": {
    "signal_id": "<string>"
  }
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Authorizations

Meibel-API-Key
string
header
required

Path Parameters

blueprint_instance_id
string
required

Body

application/json

Request body for chat message endpoints.

user_message
string
required

The user's chat message

timeout_seconds
integer | null
include_thinking
boolean | null
include_tool_activity
boolean | null

Response

Successful Response

A server-sent event indicating the stream connection has been established

event
string
required
Allowed value: "connected"
data
object
required