> This page is for version latest (default).
> For other versions, use one of these documentation indexes:
> - latest (default): https://docs.machanirobotics.dev/latest/llms.txt
> - v2026.01.16-dev: https://docs.machanirobotics.dev/v-2026-01-16-dev/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.machanirobotics.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.machanirobotics.dev/_mcp/server.

# Stream Messages

POST https://api.machanirobotics.com/v1/conversation/inference/chat:streamMessages
Content-Type: application/json

StreamMessages streams chat responses for a given session and message.
 The request must include the session identifier and the message content.

 HTTP Mapping: POST "/v1/conversation/inference/chat:streamMessages"

Reference: https://docs.machanirobotics.dev/latest/2026-01-16-dev/inference-service/streammessages

## Request

### Body (application/json)

This endpoint expects a StreamMessagesRequest.

- `name` (string, required) — The resource name of the session.
- `message` (string, required) — The message from the user.

## Response

### 200

OK

- `content` (InferenceOutput, optional) — The current state of the conversation processing session.

## Errors

### 400 Bad Request Error

Bad Request

- `code` (integer, optional) — The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
- `message` (string, optional) — A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
- `details` (list of GoogleProtobufAny, optional) — A list of messages that carry the error details. There is a common set of message types for APIs to use.

## Types

### InferenceOutput

InferenceOutput represents the output of a conversation message. It includes the role of the sender, the content of the message, and the language code.

- `id` (string, optional) — ID is the unique identifier for the conversation message. It is used to track the message within the conversation.
- `role` (integer, optional) — Role defines the role of the sender in the conversation. It uses the InferenceRole enum to indicate if the message comes from the user, assistant, system, or a custom role.
- `text` (InferenceText, optional) — Text message content.
- `image` (InferenceGenerateImageOutput, optional) — Image Generation message content.
- `vision` (InferenceVisionOutput, optional) — Vision message content.
- `options` (InferenceOptions, optional) — Inference Options provides additional settings for the conversation.

### GoogleProtobufAny

Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.

- `@type` (string, optional) — The type of the serialized message.

### InferenceText

InferenceText is a message that contains text content.

- `content` (list of string, required) — Content is the actual text content of the message.

### InferenceGenerateImageOutput

InferenceGenerateImageOutput is a message that contains the output of the image generation process.

- `id` (string, optional) — ID is the unique identifier for the conversation vision message. It is used to track the message within the conversation.
- `uris` (list of string, optional) — uris is a slice of URLs where images are stored.
- `b64Json` (list of string, optional) — B64JSON is a slice of base64-encoded image data.
- `savedPaths` (list of string, optional) — SavedPaths is a slice of local file paths where images are saved.

### InferenceVisionOutput

Output of vision processing on a InferenceVisionMessage.

- `id` (string, optional) — Matches the `id` of the source InferenceVisionMessage.
- `description` (string, optional) — Human-readable summary of the image contents.
- `objects` (list of VisionObjectMetadata, optional) — List of objects detected in the image (may be empty).

### InferenceOptions

InferenceOptions is a message that contains options for configuring the conversation. It includes the language code for the message and specifies which conversation processing service to use.

- `service` (integer, required) — Specifies which conversation processing service handles this dialogue.
- `model` (string, required) — Specifies the model to be used for processing the conversation.
- `languageTag` (InferenceLanguage, required) — InferenceLanguage specifies the language code for the message.

### VisionObjectMetadata

Describes a single object detected in an image.

- `object` (string, required) — object_name of the detected object, e.g., "person", "dog", "chair".
- `confidence` (double, required) — Confidence score (0.0 to 1.0) for this detection.
- `boundingBox` (VisionBoundingBox, required) — Bounding box around the detected object.

### InferenceLanguage

InferenceLanguage is the language code for the robot's conversation.

- `countryTag` (integer, required) — The country code for the robot's conversation.
- `languageTag` (integer, required) — The language code for the robot's conversation.
- `inputAudio` (string, optional) — The audio input for the robot's conversation.
- `inputText` (string, optional) — The text input for the robot's conversation.
- `inputSpeech` (string, optional) — The speech input for the robot's conversation.
- `inputNone` (boolean, optional) — The none input for the robot's conversation.
- `outputAudio` (string, optional) — The audio output for the robot's conversation.
- `outputText` (string, optional) — The text output for the robot's conversation.
- `outputSpeech` (string, optional) — The speech output for the robot's conversation.
- `outputNone` (boolean, optional) — The none output for the robot's conversation.

### VisionBoundingBox

Represents a rectangular region in an image.

- `x` (integer, required) — X coordinate of the top-left corner of the box (in pixels).
- `y` (integer, required) — Y coordinate of the top-left corner of the box (in pixels).
- `width` (integer, required) — Width of the box (in pixels).
- `height` (integer, required) — Height of the box (in pixels).

## Examples

**Request**

```json
{
  "name": "sessions/abc123xyz",
  "message": "Can you provide an update on the current project status?"
}
```

**Response**

```json
{
  "content": {
    "id": "msg-7890defg",
    "role": 2,
    "text": {
      "content": [
        "The project is progressing well with all milestones on track for completion by the end of Q2."
      ]
    },
    "image": {
      "id": "img-4567hijk",
      "uris": [
        "https://cdn.machanirobotics.com/images/project-status-chart.png"
      ],
      "b64Json": [
        "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAC0y0bNAAA..."
      ],
      "savedPaths": [
        "/var/data/images/project-status-chart.png"
      ]
    },
    "vision": {
      "id": "vision-1234lmno",
      "description": "Image contains a bar chart showing project progress with milestones marked.",
      "objects": [
        {
          "object": "bar chart",
          "confidence": 0.98,
          "boundingBox": {
            "x": 50,
            "y": 100,
            "width": 400,
            "height": 300
          }
        }
      ]
    },
    "options": {
      "service": 3,
      "model": "machani-chat-v2",
      "languageTag": {
        "countryTag": 840,
        "languageTag": 9,
        "inputAudio": "audio/wav",
        "inputText": "text/plain",
        "inputSpeech": "speech/pcm",
        "inputNone": false,
        "outputAudio": "audio/mp3",
        "outputText": "text/html",
        "outputSpeech": "speech/ogg",
        "outputNone": false
      }
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.machanirobotics.com/v1/conversation/inference/chat:streamMessages"

payload = {
    "name": "sessions/abc123xyz",
    "message": "Can you provide an update on the current project status?"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.machanirobotics.com/v1/conversation/inference/chat:streamMessages';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"name":"sessions/abc123xyz","message":"Can you provide an update on the current project status?"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.machanirobotics.com/v1/conversation/inference/chat:streamMessages"

	payload := strings.NewReader("{\n  \"name\": \"sessions/abc123xyz\",\n  \"message\": \"Can you provide an update on the current project status?\"\n}")

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

	req.Header.Add("Content-Type", "application/json")

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

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

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.machanirobotics.com/v1/conversation/inference/chat:streamMessages")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"sessions/abc123xyz\",\n  \"message\": \"Can you provide an update on the current project status?\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.machanirobotics.com/v1/conversation/inference/chat:streamMessages")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"sessions/abc123xyz\",\n  \"message\": \"Can you provide an update on the current project status?\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.machanirobotics.com/v1/conversation/inference/chat:streamMessages', [
  'body' => '{
  "name": "sessions/abc123xyz",
  "message": "Can you provide an update on the current project status?"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.machanirobotics.com/v1/conversation/inference/chat:streamMessages");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"sessions/abc123xyz\",\n  \"message\": \"Can you provide an update on the current project status?\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "name": "sessions/abc123xyz",
  "message": "Can you provide an update on the current project status?"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.machanirobotics.com/v1/conversation/inference/chat:streamMessages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```