client.cli_listen
The CLI’s listen tunnel: events and tool calls forwarded to your machine. These methods are on client.cli_listen, where client is a MoreVoice client (see the Python SDK). On AsyncMoreVoice the same methods are awaited. Each one returns the response object and raises an exception when the API answers with an error.
stream()
Section titled “stream()”Open a CLI listen session. The stream behind the CLI’s listen command: your organisation’s events for this key’s mode (each with the exact body and Standard Webhooks headers to POST to your local endpoint, signed with the session’s secret) and, with forward_tools=true, tool calls to answer from your machine — tools whose URL is cli://<name> and, in test mode, every webhook tool of your test calls. The session ends when the stream closes. Use a test key; a live key needs live=true and the webhooks:write scope. Counts against the key’s stream limit.
client.cli_listen.stream() · await async_client.cli_listen.stream() · GET /cli/listen · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
events |
string | string[] |
no | Event types to forward: a type (call.ended), a group (call.*) or *; comma-separated or repeated. Default: every event (opt-in live types only when named). |
forward_tools |
"true" | "false" |
no | true: this session answers tool calls — tools whose URL is cli://<name> and, in test mode, every webhook tool of the organisation’s test calls. Needs the tools:write scope. |
live |
"true" | "false" |
no | Required (true) with a live key: live events and tool calls of live calls reach your machine. Needs the webhooks:write scope. |
last_event_id |
string |
no | Resume after this event (evt_…), for clients that cannot send Last-Event-ID. |
Returns
Section titled “Returns”A stream of events (Server-Sent Events): iterate it, or async for it on AsyncMoreVoice.
Example
Section titled “Example”import os
import httpx
url = "https://api.morevoice.ai/v1/cli/listen"headers = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}", "Accept": "text/event-stream"}with httpx.stream("GET", url, headers=headers, timeout=None) as response: response.raise_for_status() for line in response.iter_lines(): if line.startswith("data:"): print(line[5:].strip())