@b3os/cli 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -7
- package/assets/b3os-run.py +137 -0
- package/assets/skill/b3os/SKILL.md +111 -0
- package/dist/commands/_agents.d.ts +14 -0
- package/dist/commands/_agents.js +33 -0
- package/dist/commands/_agents.js.map +1 -0
- package/dist/commands/_common.js +6 -2
- package/dist/commands/_common.js.map +1 -1
- package/dist/commands/_context.d.ts +49 -0
- package/dist/commands/_context.js +260 -0
- package/dist/commands/_context.js.map +1 -0
- package/dist/commands/_next.d.ts +39 -0
- package/dist/commands/_next.js +77 -0
- package/dist/commands/_next.js.map +1 -0
- package/dist/commands/agent.d.ts +42 -0
- package/dist/commands/agent.js +218 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/app.d.ts +2 -0
- package/dist/commands/app.js +559 -54
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/auth.d.ts +88 -2
- package/dist/commands/auth.js +354 -44
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/docs.d.ts +54 -0
- package/dist/commands/docs.js +202 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/doctor.d.ts +23 -0
- package/dist/commands/doctor.js +313 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +38 -1
- package/dist/commands/init.js +259 -60
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/listen.d.ts +30 -0
- package/dist/commands/listen.js +194 -0
- package/dist/commands/listen.js.map +1 -0
- package/dist/commands/manifest.d.ts +13 -1
- package/dist/commands/manifest.js +81 -18
- package/dist/commands/manifest.js.map +1 -1
- package/dist/commands/mcp.d.ts +25 -2
- package/dist/commands/mcp.js +120 -11
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/sandbox.d.ts +35 -6
- package/dist/commands/sandbox.js +208 -9
- package/dist/commands/sandbox.js.map +1 -1
- package/dist/commands/setup.d.ts +39 -0
- package/dist/commands/setup.js +203 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/tool.d.ts +154 -0
- package/dist/commands/tool.js +785 -0
- package/dist/commands/tool.js.map +1 -0
- package/dist/config.d.ts +30 -6
- package/dist/config.js +39 -8
- package/dist/config.js.map +1 -1
- package/dist/ctx.d.ts +5 -45
- package/dist/ctx.js +25 -160
- package/dist/ctx.js.map +1 -1
- package/dist/docs/index.json +1 -0
- package/dist/docs/pages/actions/call.md +300 -0
- package/dist/docs/pages/actions/catalog/airtable.md +737 -0
- package/dist/docs/pages/actions/catalog/arxiv.md +166 -0
- package/dist/docs/pages/actions/catalog/chainalysis-sanctions.md +125 -0
- package/dist/docs/pages/actions/catalog/coingecko.md +1558 -0
- package/dist/docs/pages/actions/catalog/deps-dev.md +465 -0
- package/dist/docs/pages/actions/catalog/dexscreener.md +568 -0
- package/dist/docs/pages/actions/catalog/discord.md +784 -0
- package/dist/docs/pages/actions/catalog/finnhub.md +776 -0
- package/dist/docs/pages/actions/catalog/frankfurter.md +438 -0
- package/dist/docs/pages/actions/catalog/github.md +1853 -0
- package/dist/docs/pages/actions/catalog/gmail.md +575 -0
- package/dist/docs/pages/actions/catalog/google-calendar.md +654 -0
- package/dist/docs/pages/actions/catalog/google-drive.md +502 -0
- package/dist/docs/pages/actions/catalog/google-sheets.md +700 -0
- package/dist/docs/pages/actions/catalog/hacker-news.md +542 -0
- package/dist/docs/pages/actions/catalog/http.md +824 -0
- package/dist/docs/pages/actions/catalog/hyperliquid.md +942 -0
- package/dist/docs/pages/actions/catalog/jira.md +920 -0
- package/dist/docs/pages/actions/catalog/kalshi.md +917 -0
- package/dist/docs/pages/actions/catalog/linear.md +1030 -0
- package/dist/docs/pages/actions/catalog/markets.md +21 -0
- package/dist/docs/pages/actions/catalog/morpho.md +247 -0
- package/dist/docs/pages/actions/catalog/notion.md +1077 -0
- package/dist/docs/pages/actions/catalog/nws.md +485 -0
- package/dist/docs/pages/actions/catalog/open-meteo.md +559 -0
- package/dist/docs/pages/actions/catalog/polymarket.md +1523 -0
- package/dist/docs/pages/actions/catalog/pushbullet.md +220 -0
- package/dist/docs/pages/actions/catalog/resend.md +307 -0
- package/dist/docs/pages/actions/catalog/s3.md +513 -0
- package/dist/docs/pages/actions/catalog/sec-edgar.md +487 -0
- package/dist/docs/pages/actions/catalog/slack.md +2629 -0
- package/dist/docs/pages/actions/catalog/stripe.md +1405 -0
- package/dist/docs/pages/actions/catalog/wikipedia.md +379 -0
- package/dist/docs/pages/actions/catalog.md +46 -0
- package/dist/docs/pages/actions/limits.md +50 -0
- package/dist/docs/pages/actions/model-tools.md +225 -0
- package/dist/docs/pages/actions/packs.md +148 -0
- package/dist/docs/pages/actions/settings.md +69 -0
- package/dist/docs/pages/actions/tools.md +244 -0
- package/dist/docs/pages/actions/triggers.md +149 -0
- package/dist/docs/pages/actions.md +88 -0
- package/dist/docs/pages/compat/anthropic.md +168 -0
- package/dist/docs/pages/compat/e2b.md +194 -0
- package/dist/docs/pages/compat/firecrawl.md +138 -0
- package/dist/docs/pages/compat/openai.md +168 -0
- package/dist/docs/pages/concepts/auth.md +151 -0
- package/dist/docs/pages/concepts/beta.md +55 -0
- package/dist/docs/pages/concepts/glossary.md +71 -0
- package/dist/docs/pages/concepts/ids.md +98 -0
- package/dist/docs/pages/concepts/jobs.md +229 -0
- package/dist/docs/pages/concepts/latency.md +138 -0
- package/dist/docs/pages/concepts/limits.md +191 -0
- package/dist/docs/pages/concepts/stack.md +59 -0
- package/dist/docs/pages/concepts/timing.md +86 -0
- package/dist/docs/pages/concepts/usage.md +110 -0
- package/dist/docs/pages/design/b3os-yaml.md +370 -0
- package/dist/docs/pages/design/deploy-from-github.md +122 -0
- package/dist/docs/pages/design/observability.md +134 -0
- package/dist/docs/pages/errors.md +1824 -0
- package/dist/docs/pages/infer/chat.md +570 -0
- package/dist/docs/pages/infer/limits.md +55 -0
- package/dist/docs/pages/infer/messages.md +185 -0
- package/dist/docs/pages/infer/responses.md +173 -0
- package/dist/docs/pages/infer/settings.md +154 -0
- package/dist/docs/pages/infer/speech.md +323 -0
- package/dist/docs/pages/infer.md +154 -0
- package/dist/docs/pages/introduction.md +162 -0
- package/dist/docs/pages/platform/addresses.md +174 -0
- package/dist/docs/pages/platform/call-log.md +99 -0
- package/dist/docs/pages/platform/custom-domains.md +104 -0
- package/dist/docs/pages/platform/keys.md +79 -0
- package/dist/docs/pages/platform/limits.md +57 -0
- package/dist/docs/pages/platform/members.md +101 -0
- package/dist/docs/pages/platform/requests.md +116 -0
- package/dist/docs/pages/platform/settings.md +129 -0
- package/dist/docs/pages/platform/webhooks.md +68 -0
- package/dist/docs/pages/platform.md +67 -0
- package/dist/docs/pages/quickstart/mcp.md +94 -0
- package/dist/docs/pages/quickstart/sandbox-agent.md +205 -0
- package/dist/docs/pages/quickstart/scrape.md +134 -0
- package/dist/docs/pages/quickstart.md +45 -0
- package/dist/docs/pages/render/inspections.md +162 -0
- package/dist/docs/pages/render/limits.md +72 -0
- package/dist/docs/pages/render/screenshots.md +179 -0
- package/dist/docs/pages/render/settings.md +431 -0
- package/dist/docs/pages/render/styles.md +342 -0
- package/dist/docs/pages/render/videos.md +272 -0
- package/dist/docs/pages/render.md +118 -0
- package/dist/docs/pages/routines/callables.md +174 -0
- package/dist/docs/pages/routines/definitions.md +361 -0
- package/dist/docs/pages/routines/limits.md +117 -0
- package/dist/docs/pages/routines/runs.md +328 -0
- package/dist/docs/pages/routines/settings.md +104 -0
- package/dist/docs/pages/routines/triggers.md +339 -0
- package/dist/docs/pages/routines.md +216 -0
- package/dist/docs/pages/sandboxes/agents.md +217 -0
- package/dist/docs/pages/sandboxes/commands.md +272 -0
- package/dist/docs/pages/sandboxes/images.md +166 -0
- package/dist/docs/pages/sandboxes/limits.md +143 -0
- package/dist/docs/pages/sandboxes/ports.md +260 -0
- package/dist/docs/pages/sandboxes/settings.md +358 -0
- package/dist/docs/pages/sandboxes/snapshots.md +423 -0
- package/dist/docs/pages/sandboxes/swarms.md +146 -0
- package/dist/docs/pages/sandboxes/volumes.md +131 -0
- package/dist/docs/pages/sandboxes.md +231 -0
- package/dist/docs/pages/sdks/cli.md +121 -0
- package/dist/docs/pages/sdks/mcp.md +169 -0
- package/dist/docs/pages/sdks/python.md +146 -0
- package/dist/docs/pages/sdks/typescript.md +202 -0
- package/dist/docs/pages/sdks.md +282 -0
- package/dist/docs/pages/settings.md +33 -0
- package/dist/docs/pages/vault/limits.md +46 -0
- package/dist/docs/pages/vault.md +133 -0
- package/dist/docs/pages/vision/agent-browser.md +115 -0
- package/dist/docs/pages/vision/crawl.md +333 -0
- package/dist/docs/pages/vision/extract.md +152 -0
- package/dist/docs/pages/vision/fetcher.md +15 -0
- package/dist/docs/pages/vision/limits.md +79 -0
- package/dist/docs/pages/vision/profiles.md +111 -0
- package/dist/docs/pages/vision/proxy.md +131 -0
- package/dist/docs/pages/vision/scrape.md +356 -0
- package/dist/docs/pages/vision/sessions.md +311 -0
- package/dist/docs/pages/vision/settings.md +656 -0
- package/dist/docs/pages/vision.md +175 -0
- package/dist/errors.d.ts +129 -0
- package/dist/errors.js +326 -0
- package/dist/errors.js.map +1 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +26 -13
- package/dist/main.js.map +1 -1
- package/dist/manifest/apply.d.ts +4 -0
- package/dist/manifest/apply.js +2 -0
- package/dist/manifest/apply.js.map +1 -1
- package/dist/manifest/domains.d.ts +50 -0
- package/dist/manifest/domains.js +159 -0
- package/dist/manifest/domains.js.map +1 -0
- package/dist/manifest/link.d.ts +20 -0
- package/dist/manifest/link.js +24 -0
- package/dist/manifest/link.js.map +1 -0
- package/dist/manifest/record.d.ts +1 -1
- package/dist/tool/archive.d.ts +33 -0
- package/dist/tool/archive.js +174 -0
- package/dist/tool/archive.js.map +1 -0
- package/dist/tool/calls.d.ts +46 -0
- package/dist/tool/calls.js +274 -0
- package/dist/tool/calls.js.map +1 -0
- package/dist/tool/checks.d.ts +21 -0
- package/dist/tool/checks.js +145 -0
- package/dist/tool/checks.js.map +1 -0
- package/dist/tool/elf.d.ts +19 -0
- package/dist/tool/elf.js +107 -0
- package/dist/tool/elf.js.map +1 -0
- package/dist/tool/predict.d.ts +8 -0
- package/dist/tool/predict.js +38 -0
- package/dist/tool/predict.js.map +1 -0
- package/dist/tool/ustar.d.ts +5 -0
- package/dist/tool/ustar.js +220 -0
- package/dist/tool/ustar.js.map +1 -0
- package/package.json +6 -5
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# Speech
|
|
2
|
+
|
|
3
|
+
> Synthesize speech with the node's text-to-speech model through the OpenAI speech API, and get the start and end of every word for captions.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/infer/speech.md
|
|
6
|
+
|
|
7
|
+
`POST /v1/infer/audio/speech` is the OpenAI speech API. It returns audio bytes, streamed as they are made with `stream_format`, or, with the B3OS `timestamps: "word"` extension, JSON with the audio and the timing of each word. Render uses those timings to land clicks on the words that describe them and to cut captions.
|
|
8
|
+
|
|
9
|
+
## Synthesize
|
|
10
|
+
|
|
11
|
+
**curl**
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
curl -s https://beta-api.b3os.org/v1/infer/audio/speech \
|
|
15
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
16
|
+
-H "Content-Type: application/json" \
|
|
17
|
+
-d '{"model": "kokoro-82m", "voice": "af_heart", "input": "Open the billing page.", "response_format": "mp3"}' \
|
|
18
|
+
-o speech.mp3
|
|
19
|
+
```
|
|
20
|
+
**TypeScript**
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { writeFile } from "node:fs/promises";
|
|
24
|
+
import OpenAI from "openai";
|
|
25
|
+
|
|
26
|
+
const client = new OpenAI({ apiKey: process.env.B3OS_API_KEY, baseURL: "https://beta-api.b3os.org/v1/infer" });
|
|
27
|
+
const speech = await client.audio.speech.create({
|
|
28
|
+
model: "kokoro-82m",
|
|
29
|
+
voice: "af_heart",
|
|
30
|
+
input: "Open the billing page.",
|
|
31
|
+
response_format: "mp3",
|
|
32
|
+
});
|
|
33
|
+
await writeFile("speech.mp3", Buffer.from(await speech.arrayBuffer()));
|
|
34
|
+
```
|
|
35
|
+
**Python**
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
import os
|
|
39
|
+
from openai import OpenAI
|
|
40
|
+
|
|
41
|
+
client = OpenAI(api_key=os.environ["B3OS_API_KEY"], base_url="https://beta-api.b3os.org/v1/infer")
|
|
42
|
+
speech = client.audio.speech.create(
|
|
43
|
+
model="kokoro-82m",
|
|
44
|
+
voice="af_heart",
|
|
45
|
+
input="Open the billing page.",
|
|
46
|
+
response_format="mp3",
|
|
47
|
+
)
|
|
48
|
+
with open("speech.mp3", "wb") as f:
|
|
49
|
+
f.write(speech.content)
|
|
50
|
+
```
|
|
51
|
+
**MCP**
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
Record a narrated demo of the billing page.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
No MCP tool synthesizes speech on its own. On the local MCP server, speech reaches agents through `render_video`, which narrates each beat with the voice in the request.
|
|
58
|
+
|
|
59
|
+
The model and voice IDs above are examples: take real ones from `GET /v1/infer/models` (models whose `b3os.kind` is `speech`) and `GET /v1/infer/audio/voices`.
|
|
60
|
+
|
|
61
|
+
| Field | Default | Meaning |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `model` | | A speech model's ID |
|
|
64
|
+
| `input` | | Up to 4,096 characters |
|
|
65
|
+
| `voice` | | A voice ID, or an [OpenAI voice name](#openai-voice-names) |
|
|
66
|
+
| `response_format` | `mp3` | `mp3`, `opus`, `aac`, `flac`, `wav` or `pcm` |
|
|
67
|
+
| `speed` | 1 | OpenAI's range is 0.25 to 4; `kokoro-82m` speaks at 0.5 to 2, and a speed outside a model's range is refused with `unsupported_parameter`, never clamped |
|
|
68
|
+
| `instructions` | none | Style guidance, for models that support it; `kokoro-82m` does not, so a non-blank value is refused |
|
|
69
|
+
| `timestamps` | `none` | `word` returns JSON with word timings instead of audio bytes |
|
|
70
|
+
| `language` | the voice's | B3OS extension: read `input` in another [language](#languages) than the voice's own |
|
|
71
|
+
| `stream_format` | none | `audio` or `sse`: [stream](#stream) the audio as it is made; unset, the clip comes in one piece |
|
|
72
|
+
|
|
73
|
+
## Stream
|
|
74
|
+
|
|
75
|
+
Set `stream_format` and the audio arrives as it is made, a sentence at a time. The first audio comes when the first sentence is synthesized rather than the whole clip, so the longer the text, the more you save; a one-sentence text gains nothing. `audio` sends the bytes of `response_format` as they come; `sse` sends them base64-encoded in `speech.audio.delta` events.
|
|
76
|
+
|
|
77
|
+
**curl**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
curl -sN https://beta-api.b3os.org/v1/infer/audio/speech \
|
|
81
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
82
|
+
-H "Content-Type: application/json" \
|
|
83
|
+
-d '{"model": "kokoro-82m", "voice": "af_heart", "input": "Open the billing page. Then switch to annual billing.", "response_format": "wav", "stream_format": "audio"}' \
|
|
84
|
+
| ffplay -nodisp -autoexit -loglevel error -
|
|
85
|
+
```
|
|
86
|
+
**Python**
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import os
|
|
90
|
+
from openai import OpenAI
|
|
91
|
+
|
|
92
|
+
client = OpenAI(api_key=os.environ["B3OS_API_KEY"], base_url="https://beta-api.b3os.org/v1/infer")
|
|
93
|
+
with client.audio.speech.with_streaming_response.create(
|
|
94
|
+
model="kokoro-82m",
|
|
95
|
+
voice="af_heart",
|
|
96
|
+
input="Open the billing page. Then switch to annual billing.",
|
|
97
|
+
response_format="pcm",
|
|
98
|
+
stream_format="audio",
|
|
99
|
+
) as response:
|
|
100
|
+
with open("speech.pcm", "wb") as f:
|
|
101
|
+
for chunk in response.iter_bytes():
|
|
102
|
+
f.write(chunk) # 16-bit mono at 24 kHz: hand each chunk to a player as it arrives
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The response head waits for the first audio, so its `Server-Timing` carries `ttfa`, the time from the request to the first audio bytes, and an error before any audio (an unknown voice, a busy node) is a plain HTTP error.
|
|
106
|
+
|
|
107
|
+
The node trims the silence the model puts in front of the first word, streamed or not, so the audio starts with the word itself: in `pcm` and `wav` the first clearly audible sample (above -45 dBFS) is at most a twentieth of a second into the clip, where the model alone left about a quarter of a second. `mp3` puts its encoder's start-up delay in front of that, so there it is under a tenth of a second. `ttfa` plus that offset is when a listener first hears the answer, and the benchmarks report it beside `ttfa` as time to first sound. Word timings count from the first sample of the audio you receive, so they already include the trim. A streamed `wav` has a header with open sizes (`0xFFFFFFFF`, as ffmpeg writes to a pipe), which players read to the end of the stream; `mp3`, `opus`, `aac` and `flac` are encoded as the audio arrives.
|
|
108
|
+
|
|
109
|
+
With `"stream_format": "sse"` each event names its type:
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
event: speech.audio.delta
|
|
113
|
+
data: {"audio":"SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYzLjE3LjEwMAAAAAAAAAAAAAAA//PExAAAAANIAAAAAExBTUU0…","type":"speech.audio.delta"}
|
|
114
|
+
|
|
115
|
+
event: speech.audio.done
|
|
116
|
+
data: {"b3os":{"node":"n1","route":"local","timing":{"total_ms":85.048,"voice_queue_ms":0.063,"voice_run_ms":76.695}},"duration_ms":4050,"format":"mp3","model":"kokoro-82m","sample_rate":24000,"type":"speech.audio.done","voice":"af_heart","words":[{"end_ms":588,"start_ms":300,"text":"Open"},{"end_ms":675,"start_ms":588,"text":"the"},{"end_ms":1000,"start_ms":675,"text":"billing"},{"end_ms":1775,"start_ms":1000,"text":"page."},{"end_ms":2388,"start_ms":2150,"text":"Then"},{"end_ms":2700,"start_ms":2388,"text":"switch"},{"end_ms":2838,"start_ms":2700,"text":"to"},{"end_ms":3175,"start_ms":2838,"text":"annual"},{"end_ms":3950,"start_ms":3175,"text":"billing."}]}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
<sub>Recorded 2026-11-02 from production (`beta-api.b3os.org`, node `n1`) by the gallery case `infer/speech-stream-sse`, `"response_format": "mp3"`, `"timestamps": "word"`, input "Open the billing page. Then switch to annual billing."; four deltas (4,269, 23,424, 32,768 and 5,248 bytes), the first cut short above. Its head: `server-timing: edge_auth;dur=18.000, edge_upstream;dur=55.000, infer_route;desc="local", prep;dur=0.227, ttfa;dur=40.088`, request id `req_01m6e33e4cjj2318w0x498fgd9`.</sub>
|
|
120
|
+
|
|
121
|
+
The deltas joined are the whole clip. `speech.audio.done` closes the stream with the clip's format and duration, the `words` when the request sets `"timestamps": "word"` (word timings stream only this way: `timestamps: "word"` with `stream_format: "audio"` is refused, since an audio stream carries only audio), and the node's timing. It has no `usage`, since speech bills characters, not tokens. A failure after audio has been sent ends an `sse` stream with an `error` event and cuts an `audio` stream short; each part of the input that produced audio is billed.
|
|
122
|
+
|
|
123
|
+
## Markup
|
|
124
|
+
|
|
125
|
+
Text written by a language model often carries stage directions and markdown. The node does not read them aloud, and it turns `<break>` into silence, so you can pass a model's reply to speech as it is:
|
|
126
|
+
|
|
127
|
+
| In the input | Read as |
|
|
128
|
+
|---|---|
|
|
129
|
+
| `[laughs]`, `[sighs heavily]` (a sound or gesture in square brackets) | nothing |
|
|
130
|
+
| `[Save]`, `[Ctrl+C]` (any other square brackets) | the words, without the brackets |
|
|
131
|
+
| `*sigh*`, `*clears throat*` (a sound or gesture between single asterisks) | nothing |
|
|
132
|
+
| `**bold**`, `*really*`, `_word_`, `~~gone~~`, `` `code` `` | the words, without the marks |
|
|
133
|
+
| `[the guide](https://example.com/guide)` | the link's text |
|
|
134
|
+
| `# Title`, `> quote`, `- item`, `- [x] task` at the start of a line; code fence and rule lines | the line's text; fences and rules are skipped |
|
|
135
|
+
| `<break time="..."/>`, with the time in seconds (`s`) or milliseconds (`ms`), or a bare `<break/>` | that much silence, at most five seconds; a bare `<break/>` is half a second |
|
|
136
|
+
| any other tag, such as `<emphasis>` or `</speak>` | nothing; the text between tags is read |
|
|
137
|
+
|
|
138
|
+
Word timestamps still cover every token of your input: a token with nothing spoken in it, such as `[laughs]`, has `start_ms` equal to `end_ms`. Marks pair on one line, an opening mark with the nearest closing one after it, so `*a *b c*` reads "*a b c". A `*` or `_` inside a word or between spaces (`3 * 4`, `voice_not_found`) is read as before, and so are `<` and `>` that do not make a tag (`a<b and c>d`, `Vec<String>`): a tag is a name followed only by `name="value"` attributes, and an opening tag directly after a letter or digit counts only when it closes itself or its closing tag follows, so `CO<sub>2</sub>` reads "CO2".
|
|
139
|
+
|
|
140
|
+
One request's breaks add up to at most 60 seconds of silence and split the input into at most 100 spoken parts. An input over either is refused before anything is synthesized, with `400` [`invalid_request`](https://docs.beta.b3os.org/errors#invalid_request) saying which. The whole clip is at most 5 minutes; past that the request fails with `413` [`payload_too_large`](https://docs.beta.b3os.org/errors#payload_too_large), and a stream ends there with an error.
|
|
141
|
+
|
|
142
|
+
## Word timestamps
|
|
143
|
+
|
|
144
|
+
With `"timestamps": "word"` the response is JSON instead of audio bytes:
|
|
145
|
+
|
|
146
|
+
**Response 200**
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"audio_base64": "SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYzLjE3LjEwMAAAAAAAAAAAAAAA//PExAAKGAIqX0AQAAFRZJRxIL5rB+IKqMTwwUdwx92s/8QQx/iA5/8v///4f/wQ//L0f/PpiCmopoXGJAUMLY4NDCQGBSqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqHhMKwFSLBQjGhgnGZIyytOMiA0xDBkySMg0Nc2WWRgAQUHxzDEJlSOyVKTTmAoEcwJwHQwCM0S0izL1EkM1QjyYZyXTbMYEIDIGAPEYALHjOgLeMqw5A0AiHDBDE8divVkbXIfUHiCxHUMkYoox2AxjGFDZMAYKwwogRlrxz…",
|
|
151
|
+
"duration_ms": 1552,
|
|
152
|
+
"format": "mp3",
|
|
153
|
+
"model": "kokoro-82m",
|
|
154
|
+
"object": "speech",
|
|
155
|
+
"sample_rate": 24000,
|
|
156
|
+
"voice": "af_heart",
|
|
157
|
+
"words": [
|
|
158
|
+
{
|
|
159
|
+
"end_ms": 265,
|
|
160
|
+
"start_ms": 0,
|
|
161
|
+
"text": "Open"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"end_ms": 352,
|
|
165
|
+
"start_ms": 265,
|
|
166
|
+
"text": "the"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"end_ms": 677,
|
|
170
|
+
"start_ms": 352,
|
|
171
|
+
"text": "billing"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"end_ms": 1452,
|
|
175
|
+
"start_ms": 677,
|
|
176
|
+
"text": "page."
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Request**
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
curl -s -X POST 'https://beta-api.b3os.org/v1/infer/audio/speech' \
|
|
186
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
187
|
+
-H 'content-type: application/json' \
|
|
188
|
+
-d '{"model":"kokoro-82m","voice":"af_heart","input":"Open the billing page.","response_format":"mp3","timestamps":"word"}'
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Server-Timing**
|
|
192
|
+
|
|
193
|
+
```http
|
|
194
|
+
server-timing: edge_auth;dur=0.000, edge_upstream;dur=66.000, infer_route;desc="local", prep;dur=0.163, synthesize;dur=27.518, encode;dur=17.876, voice_queue;dur=0.095, voice_run;dur=26.053, total;dur=45.663
|
|
195
|
+
x-request-id: req_01m6h0e5gs24sfn2eda25d09sm
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
<sub>Captured 2026-11-03 from commit `794650bb` on the host the node runs on, one call, label `live-recorded` (recorded from production); long values abridged. Case `infer/speech-word-timings`.</sub>
|
|
199
|
+
|
|
200
|
+
`audio_base64` holds the audio in `format` (cut short above), and each word has its start and end in milliseconds from the start of the audio.
|
|
201
|
+
|
|
202
|
+
## Voices
|
|
203
|
+
|
|
204
|
+
`GET /v1/infer/audio/voices` lists each speech model's voices with their `language`, `gender`, `word_timings` (where the word timings come from: `model` or `aligner`), their place in the catalog, and a `sample_url`, a short recording you can play before you choose. Filter with `?model=`. It is a B3OS endpoint, so it returns a B3OS list and B3OS [problem errors](https://docs.beta.b3os.org/errors) rather than OpenAI's shape.
|
|
205
|
+
|
|
206
|
+
The list starts with the `featured` voices, a short list picked to start with, and ends with the `limited` ones: the voices Kokoro's authors grade lowest for their training data, and the Santa voices. Show those behind an "All voices" control; every voice can still be used by its ID. `use_case` says what a featured voice was picked for (`narration`, `conversation` or `character`), and `default` marks one voice per language to start with. Every voice is leveled to the same loudness, so switching voices does not change the volume.
|
|
207
|
+
|
|
208
|
+
| Featured voice | Language | Gender | Use case |
|
|
209
|
+
|---|---|---|---|
|
|
210
|
+
| `af_heart` | en-US | female | narration (the default for en-US) |
|
|
211
|
+
| `af_bella` | en-US | female | conversation |
|
|
212
|
+
| `af_nicole` | en-US | female | conversation |
|
|
213
|
+
| `bf_emma` | en-GB | female | narration (the default for en-GB) |
|
|
214
|
+
| `am_michael` | en-US | male | narration |
|
|
215
|
+
| `am_fenrir` | en-US | male | conversation |
|
|
216
|
+
| `bm_george` | en-GB | male | narration |
|
|
217
|
+
| `ff_siwis` | fr-FR | female | narration (the default for fr-FR) |
|
|
218
|
+
|
|
219
|
+
Hear each featured voice before you choose. The narration voices read “Open the billing page, then switch to annual. The total updates as you type.” The conversation voices read “Sure, I can help with that. Your order shipped this morning and arrives on Thursday.” `ff_siwis` reads “Ouvrez la page de facturation, puis passez à l'offre annuelle. Le total se met à jour.” Recorded from production with `response_format: "pcm"` on 2026-11-03; the same recordings play on the [infer page](https://beta.b3os.org/infer).
|
|
220
|
+
|
|
221
|
+
**af\_heart (narration)**
|
|
222
|
+
|
|
223
|
+
<audio preload="none" controls aria-label="af_heart (narration)" src="https://beta.b3os.org/assets/voices/lines/af_heart.mp3"></audio>
|
|
224
|
+
|
|
225
|
+
[Download the audio](https://beta.b3os.org/assets/voices/lines/af_heart.mp3)
|
|
226
|
+
|
|
227
|
+
**af\_bella (conversation)**
|
|
228
|
+
|
|
229
|
+
<audio preload="none" controls aria-label="af_bella (conversation)" src="https://beta.b3os.org/assets/voices/lines/af_bella.mp3"></audio>
|
|
230
|
+
|
|
231
|
+
[Download the audio](https://beta.b3os.org/assets/voices/lines/af_bella.mp3)
|
|
232
|
+
|
|
233
|
+
**af\_nicole (conversation)**
|
|
234
|
+
|
|
235
|
+
<audio preload="none" controls aria-label="af_nicole (conversation)" src="https://beta.b3os.org/assets/voices/lines/af_nicole.mp3"></audio>
|
|
236
|
+
|
|
237
|
+
[Download the audio](https://beta.b3os.org/assets/voices/lines/af_nicole.mp3)
|
|
238
|
+
|
|
239
|
+
**bf\_emma (narration)**
|
|
240
|
+
|
|
241
|
+
<audio preload="none" controls aria-label="bf_emma (narration)" src="https://beta.b3os.org/assets/voices/lines/bf_emma.mp3"></audio>
|
|
242
|
+
|
|
243
|
+
[Download the audio](https://beta.b3os.org/assets/voices/lines/bf_emma.mp3)
|
|
244
|
+
|
|
245
|
+
**am\_michael (narration)**
|
|
246
|
+
|
|
247
|
+
<audio preload="none" controls aria-label="am_michael (narration)" src="https://beta.b3os.org/assets/voices/lines/am_michael.mp3"></audio>
|
|
248
|
+
|
|
249
|
+
[Download the audio](https://beta.b3os.org/assets/voices/lines/am_michael.mp3)
|
|
250
|
+
|
|
251
|
+
**am\_fenrir (conversation)**
|
|
252
|
+
|
|
253
|
+
<audio preload="none" controls aria-label="am_fenrir (conversation)" src="https://beta.b3os.org/assets/voices/lines/am_fenrir.mp3"></audio>
|
|
254
|
+
|
|
255
|
+
[Download the audio](https://beta.b3os.org/assets/voices/lines/am_fenrir.mp3)
|
|
256
|
+
|
|
257
|
+
**bm\_george (narration)**
|
|
258
|
+
|
|
259
|
+
<audio preload="none" controls aria-label="bm_george (narration)" src="https://beta.b3os.org/assets/voices/lines/bm_george.mp3"></audio>
|
|
260
|
+
|
|
261
|
+
[Download the audio](https://beta.b3os.org/assets/voices/lines/bm_george.mp3)
|
|
262
|
+
|
|
263
|
+
**ff\_siwis (narration)**
|
|
264
|
+
|
|
265
|
+
<audio preload="none" controls aria-label="ff_siwis (narration)" src="https://beta.b3os.org/assets/voices/lines/ff_siwis.mp3"></audio>
|
|
266
|
+
|
|
267
|
+
[Download the audio](https://beta.b3os.org/assets/voices/lines/ff_siwis.mp3)
|
|
268
|
+
|
|
269
|
+
`kokoro-82m` has 37 voices in six languages. The first letter of an ID is the language and the second the gender (`f` or `m`): `af_` and `am_` are en-US (20 voices, such as `af_heart`, which these docs use), `bf_` and `bm_` en-GB (8), `ef_` and `em_` es-ES (3), `ff_` fr-FR (1), `if_` and `im_` it-IT (2), and `pf_` and `pm_` pt-BR (3). The en-US and en-GB voices take their word timings from the model; the other languages take them from a forced aligner run on the synthesized audio. OpenAI's voice names also work (below); any other unknown voice fails with [`voice_not_found`](https://docs.beta.b3os.org/errors#voice_not_found). An input longer than the model takes at once is split at sentence ends, and the word timings run on across the parts.
|
|
270
|
+
|
|
271
|
+
### Languages
|
|
272
|
+
|
|
273
|
+
Each voice reads in its own language unless the request sets `language`, a BCP 47 tag from the `language` values of the model's voices (case does not matter). `kokoro-82m` reads these:
|
|
274
|
+
|
|
275
|
+
| `language` | Voices | Word timings |
|
|
276
|
+
|---|---|---|
|
|
277
|
+
| `en-US` | `af_`, `am_` (20) | the model |
|
|
278
|
+
| `en-GB` | `bf_`, `bm_` (8) | the model |
|
|
279
|
+
| `es-ES` | `ef_`, `em_` (3) | the forced aligner |
|
|
280
|
+
| `fr-FR` | `ff_` (1) | the forced aligner |
|
|
281
|
+
| `it-IT` | `if_`, `im_` (2) | the forced aligner |
|
|
282
|
+
| `pt-BR` | `pf_`, `pm_` (3) | the forced aligner |
|
|
283
|
+
|
|
284
|
+
With `language`, a voice reads the text with that language's pronunciation, so an English voice can read French text. In a language other than English the word timings come from the forced aligner. The aligner languages are listed, and accepted, only while the node's aligner is loaded; a tag no voice speaks, or a bare `fr`, is refused with `400 unsupported_parameter` and the list in the message.
|
|
285
|
+
|
|
286
|
+
### OpenAI voice names
|
|
287
|
+
|
|
288
|
+
Code written for OpenAI's speech API can keep its voice names. `kokoro-82m` has five of them as voices of its own, and the other eight resolve to a fixed Kokoro voice each, so every name still gives a different voice. OpenAI publishes no gender or accent for its voices, so the eight are B3OS's choice, not a claim that the two sound alike. The `x-b3os-voice` response header, and the `voice` field of a `timestamps: "word"` response, name the voice that spoke.
|
|
289
|
+
|
|
290
|
+
| OpenAI name | Voice | Why this voice |
|
|
291
|
+
|---|---|---|
|
|
292
|
+
| `alloy` | `af_alloy` | the Kokoro voice of that name |
|
|
293
|
+
| `ash` | `am_michael` | fixed pick |
|
|
294
|
+
| `ballad` | `bm_george` | fixed pick |
|
|
295
|
+
| `cedar` | `am_fenrir` | fixed pick |
|
|
296
|
+
| `coral` | `af_heart` | fixed pick |
|
|
297
|
+
| `echo` | `am_echo` | the Kokoro voice of that name (limited) |
|
|
298
|
+
| `fable` | `bm_fable` | the Kokoro voice of that name |
|
|
299
|
+
| `marin` | `af_kore` | fixed pick |
|
|
300
|
+
| `nova` | `af_nova` | the Kokoro voice of that name |
|
|
301
|
+
| `onyx` | `am_onyx` | the Kokoro voice of that name (limited) |
|
|
302
|
+
| `sage` | `af_sarah` | fixed pick |
|
|
303
|
+
| `shimmer` | `af_bella` | fixed pick |
|
|
304
|
+
| `verse` | `am_puck` | fixed pick |
|
|
305
|
+
|
|
306
|
+
`echo` and `onyx` keep Kokoro's voices of those names so that each OpenAI name stays a different voice, and both are in the limited tier: Kokoro has five male voices above it against OpenAI's seven male names. For a male voice that reads better, use `am_michael` (`ash`), `am_fenrir` (`cedar`) or `bm_george` (`ballad`).
|
|
307
|
+
|
|
308
|
+
Names match exactly, in lower case (`Alloy` is `voice_not_found`). OpenAI's custom voice objects (`voice: {"id": "voice_..."}`) are refused with `400 invalid_request`.
|
|
309
|
+
|
|
310
|
+
Speech bills `infer.audio_chars`, the characters of input synthesized. The input and body limits are on [Infer limits](https://docs.beta.b3os.org/infer/limits). Render narrates videos with the same model and voices; see [styles and captions](https://docs.beta.b3os.org/render/styles#voices).
|
|
311
|
+
|
|
312
|
+
```json
|
|
313
|
+
{
|
|
314
|
+
"model": "kokoro-82m",
|
|
315
|
+
"voice": "af_heart",
|
|
316
|
+
"input": "Open the billing page.",
|
|
317
|
+
"timestamps": "word"
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
[Try it in the playground](https://beta.b3os.org/app/playground?op=inferCreateSpeech&body=eyJtb2RlbCI6Imtva29yby04Mm0iLCJ2b2ljZSI6ImFmX2hlYXJ0IiwiaW5wdXQiOiJPcGVuIHRoZSBiaWxsaW5nIHBhZ2UuIiwidGltZXN0YW1wcyI6IndvcmQifQ)
|
|
322
|
+
|
|
323
|
+
<sub>Opens the dashboard playground with this request filled in (`POST /v1/infer/audio/speech`). The link carries no key.</sub>
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Infer
|
|
2
|
+
|
|
3
|
+
> OpenAI and Anthropic compatible chat and speech from models served on the B3OS node, so an agent in a sandbox reaches its model without leaving the machine.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/infer.md
|
|
6
|
+
|
|
7
|
+
Infer serves models on the node, behind the OpenAI and Anthropic wire formats. In the beta, B3OS runs its own small model and a Kokoro text-to-speech model on a capped slice of one GPU, next to B3IQ's own inference. An agent in a [sandbox](https://docs.beta.b3os.org/sandboxes/agents) calls them at `http://127.0.0.1:7700/v1/infer` and the request never leaves the machine.
|
|
8
|
+
|
|
9
|
+
The chat model is `b3os/qwen3.5-9b`, Qwen3.5 9B in an FP8 quantization B3OS made itself ([the chat model](#the-chat-model) has the details). It has a 32,768-token context, tool calling, JSON Schema output and image input, up to 8 images of about a megapixel each. Reasoning is off unless a request turns it on. Its tool-calling quality on these FP8 weights is measured on one BFCL category so far (the model table below). The speech model is `kokoro-82m`, with 37 voices in en-US, en-GB, es-ES, fr-FR, it-IT and pt-BR. Read the IDs from `GET /v1/infer/models` in code; the node may serve other models later.
|
|
10
|
+
|
|
11
|
+
Measured on the B3OS node, from the [benchmark board](https://docs.beta.b3os.org/benchmarks#headline-results). Each figure links its raw data; the board has the conditions.
|
|
12
|
+
|
|
13
|
+
- **Under 50 ms**: First token from a 1,000-token prompt (b3os/qwen3.5-9b, p50 from a client on the same host, 2026-11-03). [Raw data](https://beta.b3os.org/raw/bench/infer/results/20261103T090624Z-w5-b2b-q/infer.chat_stream.c1.result.json)
|
|
14
|
+
- **Under 45 ms**: First token when a 1,000-token prompt repeats (b3os/qwen3.5-9b, p50 from a client on the same host, 2026-11-01). [Raw data](https://beta.b3os.org/raw/bench/infer/results/20261101T083902Z-w3-prefix-q/infer.chat_stream.same1k.result.json)
|
|
15
|
+
- **Under 5 ms**: Each output token after the first, one stream (b3os/qwen3.5-9b, p50 from a client on the same host, 2026-11-03). [Raw data](https://beta.b3os.org/raw/bench/infer/results/20261103T090624Z-w5-b2b-q/infer.chat_stream.c1.result.json)
|
|
16
|
+
- **2,270 tokens/s**: Output tokens a second across 32 streams (b3os/qwen3.5-9b, p50 from a client on the same host, 2026-11-03). [Raw data](https://beta.b3os.org/raw/bench/infer/results/20261103T090624Z-w5-b2b-q/infer.chat_stream.c32.result.json)
|
|
17
|
+
- **313x real time**: Speech made faster than real time (22.5 s of audio in 71.9 ms; kokoro-82m, p50 timed by the server, 2026-11-05). [Raw data](https://beta.b3os.org/raw/bench/infer/results/20261105T084352Z-w6-voice-q/infer.speech_ttfa.medium-c1.result.json)
|
|
18
|
+
- **Under 30 ms**: First audio of a streamed speech answer (kokoro-82m, p50 timed by the server, 2026-11-05). [Raw data](https://beta.b3os.org/raw/bench/infer/results/20261105T084352Z-w6-voice-q/infer.speech_ttfa.medium-stream-c1.result.json)
|
|
19
|
+
- **Under 45 ms**: First sound of a streamed speech answer (kokoro-82m, p50 timed by the server, 2026-11-05). [Raw data](https://beta.b3os.org/raw/bench/infer/results/20261105T084352Z-w6-voice-q/infer.speech_first_sound.short-stream-c1.result.json)
|
|
20
|
+
|
|
21
|
+
Next to other providers, each timed by B3OS from one client in the same window. A multiplier is the other provider's p50 divided by B3OS's, rounded down.
|
|
22
|
+
|
|
23
|
+
- **2.3x to 3.3x below ElevenLabs (eleven_flash_v2_5), both timed from one client**: Streamed speech, send to the first audible sample, from one client. B3OS 64.9 to 88.9 ms and ElevenLabs (eleven_flash_v2_5) 190 to 215 ms, p50 across the 3 texts, 2026-11-06. Cartesia and Inworld ran in the same run and are not published, because too few of the requests succeeded. [How it was measured](https://beta.b3os.org/benchmarks#infer)
|
|
24
|
+
|
|
25
|
+
## Models
|
|
26
|
+
|
|
27
|
+
`GET /v1/infer/models` lists what the node serves, and `GET /v1/infer/models/{model}` returns one model. Each model has the OpenAI fields plus a `b3os` object:
|
|
28
|
+
|
|
29
|
+
**Response 200**
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"b3os": {
|
|
34
|
+
"context_length": null,
|
|
35
|
+
"default_max_tokens": null,
|
|
36
|
+
"image_input": false,
|
|
37
|
+
"json_schema": false,
|
|
38
|
+
"kind": "speech",
|
|
39
|
+
"limits": {
|
|
40
|
+
"rpm": 300,
|
|
41
|
+
"tpm": null
|
|
42
|
+
},
|
|
43
|
+
"max_request_bytes": 65536,
|
|
44
|
+
"quantization": null,
|
|
45
|
+
"tools": false
|
|
46
|
+
},
|
|
47
|
+
"created": 0,
|
|
48
|
+
"id": "kokoro-82m",
|
|
49
|
+
"object": "model",
|
|
50
|
+
"owned_by": "b3os"
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Request**
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
curl -s 'https://beta-api.b3os.org/v1/infer/models/kokoro-82m' \
|
|
58
|
+
-H "Authorization: Bearer $B3OS_API_KEY"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Server-Timing**
|
|
62
|
+
|
|
63
|
+
```http
|
|
64
|
+
server-timing: edge_auth;dur=4.000, edge_upstream;dur=12.000, total;dur=0.154
|
|
65
|
+
x-request-id: req_01m6am1b2evmjmccen69qzfz16
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
<sub>Captured 2026-11-01 from commit `1f273e0a` on the host the node runs on, one call, label `live-recorded` (recorded from production). Case `infer/model-kokoro`.</sub>
|
|
69
|
+
|
|
70
|
+
`kind` is `chat`, `speech` or `embedding`; `tools`, `json_schema` and `image_input` say what a model supports; `limits` are your tokens and requests per minute on it (`null`: no limit of that kind); `default_max_tokens` is the output cap of a chat request that sets no `max_tokens` (`null`: none). Use the IDs from this list in requests; examples in these docs use `$B3OS_MODEL` for the chat model's ID.
|
|
71
|
+
|
|
72
|
+
`b3os/default` always names the node's default chat model. The list shows it with `b3os.alias_of` set to that model's ID. A request that names it is served, limited and metered as that model, and the response names the model in `model` and in the `x-b3os-model` header, so code that uses the alias keeps working when the node's model changes and can still log which model answered.
|
|
73
|
+
|
|
74
|
+
<a href="https://beta.b3os.org/gallery/docs-site/shot-infer/d9053add677fa58f.webp"><img src="https://beta.b3os.org/gallery/docs-site/shot-infer/d9053add677fa58f.webp" srcset="https://beta.b3os.org/gallery/docs-site/shot-infer/2de5611fb2d40cbf.webp 640w, https://beta.b3os.org/gallery/docs-site/shot-infer/3a1c74cd54044fa1.webp 1080w, https://beta.b3os.org/gallery/docs-site/shot-infer/d9053add677fa58f.webp 2910w" sizes="(max-width: 640px) calc(100vw - 60px), 760px" alt="Models in the dashboard: image from the capture docs-site/shot-infer" width="2910" height="2038" loading="lazy" /></a>
|
|
75
|
+
|
|
76
|
+
<sub>Captured 2026-11-15 from commit `2aac696d` on a GitHub Actions runner (colo MSP), one call, label `mock` (the dashboard in mock mode). Case `docs-site/shot-infer`.</sub>
|
|
77
|
+
|
|
78
|
+
## The chat model
|
|
79
|
+
|
|
80
|
+
| | `b3os/qwen3.5-9b` |
|
|
81
|
+
|---|---|
|
|
82
|
+
| Base model | Qwen3.5 9B ([`Qwen/Qwen3.5-9B`](https://huggingface.co/Qwen/Qwen3.5-9B), revision `c2022362`), Apache-2.0 license |
|
|
83
|
+
| Weights | FP8 (E4M3, one scale per output channel, activations quantized per token at run time), made by B3OS from the BF16 weights without calibration data. Embeddings, the output layer and the vision tower stay BF16. Relative error per tensor against BF16: 0.0263 to 0.0265 |
|
|
84
|
+
| Context | 32,768 tokens, prompt and output together. Without `max_tokens`, an answer stops at 4,096 output tokens: production's `GET /v1/infer/models/b3os/qwen3.5-9b` answers `b3os.default_max_tokens: 4096`, read with a key on 2026-11-18 ([OpenAI compatibility](https://docs.beta.b3os.org/compat/openai)). A model that lists `null` there, as the speech model above does, has no cap, and its answer can run to the end of the context |
|
|
85
|
+
| Input | Text, up to 8 images of about a megapixel each, tool definitions, a JSON Schema for the output |
|
|
86
|
+
| Reasoning | Off unless a request turns it on |
|
|
87
|
+
| Task quality | Measured on the FP8 model as served: BFCL multi_turn_base, one category of BFCL, 114 of 200 tasks in one pass, graded by BFCL's own checker (bfcl-eval 2026.3.23, function calling through `/v1/infer` in production, 2026-11-01; raw data in `bench/loop/bfcl/results/20261101T183119Z-bfcl-a-all`). Qwen publishes its scores for the BF16 release on [its model card](https://huggingface.co/Qwen/Qwen3.5-9B) |
|
|
88
|
+
| Speed | Measured on the node through b3osd, back to back at 1, 8 and 32 requests at a time. A cell's `infer.chat_stream` row is on [benchmarks](https://docs.beta.b3os.org/benchmarks), with its run, date and raw data, only while the newest run of that cell had the machine to itself |
|
|
89
|
+
| Runtime | vLLM 0.31.0 on a capped slice of one H200, prefix caching per organization (`usage.prompt_tokens_details.cached_tokens` reports hits) |
|
|
90
|
+
| Recurrent state | float32 by default in the 24 Gated DeltaNet layers, as the model's config sets it. The prefix cache works in whole 1,056-token blocks, so a prompt shorter than that never reads from it |
|
|
91
|
+
|
|
92
|
+
## A system prompt for agents
|
|
93
|
+
|
|
94
|
+
For a tool-calling agent on `b3os/qwen3.5-9b`, start from this system prompt:
|
|
95
|
+
|
|
96
|
+
```text
|
|
97
|
+
You operate tools on the user's behalf. Do exactly what the current request asks, in as few calls as possible. Pass only the arguments the request or an earlier result gives you; leave optional arguments out. Never invent credentials or values: read them from earlier results or the request. If a tool result shows an error, fix the cause once rather than repeating the call. When the requested work is done, reply in one short sentence and make no further calls.
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
It was written after reading the model's failures on BFCL's multi-turn tasks, so these are dev results, and with a system prompt BFCL is not run the way it prescribes. On 2026-11-02, in one dev pass each on the same node, the model solved 124 of 200 multi_turn_base tasks with the prompt and 117 without it (paired: 24 tasks gained, 17 lost, inside the run-to-run spread), and with the prompt its calls finished sooner and wrote about a third fewer tokens. As the check against a prompt fit to one benchmark, B3OS's own agent suite (loop-v2: 38 tasks on B3OS's tools, a different benchmark) solved 34 of 38 with the prompt in front of the suite's instructions and 33 of 38 without, one dev run each, and its median turn was shorter with the prompt. With the prompt and a short reasoning phase, `reasoning_effort: "low"` (at most 256 reasoning tokens a call), it solved 139 of 200 in one dev pass on 2026-11-03 (paired against the prompt alone: 28 gained, 13 lost, p 0.03), with each call taking about half again as long. For an agent that can afford that, it is the setting to start from. Through the production API on the deployed release (2026-11-03, one dev pass each, all 200 tasks), the prompt solved 132 and the prompt with `low` 138, where bench's locked plain pass on the release before solved 116 (paired: 33 gained and 17 lost with the prompt, 35 and 13 with `low`). Raw data: `bench/infer/results/20261102T205622Z-dev-bfcl-plain-keyorder`, `20261102T213735Z-dev-bfcl-agent-prompt`, `20261103T001328Z-dev-bfcl-prompt-low`, `20261103T160423Z-bfcl-prompt-dev-all`, `20261103T161149Z-bfcl-low-dev-all`, `20261102T213958Z-dev-loopv2-plain` and `20261102T214215Z-dev-loopv2-prompt`. The published score in the table above stays the plain run.
|
|
101
|
+
|
|
102
|
+
## No silent fallback
|
|
103
|
+
|
|
104
|
+
A request for a model the node does not serve fails with [`model_not_available`](https://docs.beta.b3os.org/errors#model_not_available). B3OS never quietly sends it somewhere else. Chat completions have an opt-in `"route": "gateway"` for models served through the B3IQ gateway, but the beta node has no gateway route configured yet, so it fails with `model_not_available` too. The `Server-Timing` header reports where each request went as `infer_route`, and responses carry `b3os.route`.
|
|
105
|
+
|
|
106
|
+
## Settings
|
|
107
|
+
|
|
108
|
+
| Setting | Default |
|
|
109
|
+
|---|---|
|
|
110
|
+
| [Output cap](https://docs.beta.b3os.org/infer/settings#output-cap): `max_tokens` | the model's `b3os.default_max_tokens`; `null` there means no cap |
|
|
111
|
+
| [Reasoning](https://docs.beta.b3os.org/infer/settings#reasoning): `reasoning_effort` | `none` |
|
|
112
|
+
|
|
113
|
+
[Infer settings](https://docs.beta.b3os.org/infer/settings) has all 8, each with its values, what it changes and an example, and what is fixed in the beta.
|
|
114
|
+
|
|
115
|
+
## What to call
|
|
116
|
+
|
|
117
|
+
| You want | Call |
|
|
118
|
+
|---|---|
|
|
119
|
+
| Chat, tools, JSON output, streaming | [`POST /v1/infer/chat/completions`](https://docs.beta.b3os.org/infer/chat) |
|
|
120
|
+
| The same through the OpenAI Responses API (stateless) | `POST /v1/infer/responses` |
|
|
121
|
+
| The same through the Anthropic Messages API | `POST /v1/infer/v1/messages`, and `.../count_tokens` to count a request's tokens |
|
|
122
|
+
| Speech, with optional word timings | [`POST /v1/infer/audio/speech`](https://docs.beta.b3os.org/infer/speech) |
|
|
123
|
+
| The voices of each speech model, with samples | `GET /v1/infer/audio/voices` |
|
|
124
|
+
| Embeddings | Planned: the beta node serves no embedding model yet, so `POST /v1/infer/embeddings` answers `404 model_not_available` |
|
|
125
|
+
|
|
126
|
+
The OpenAI and Anthropic SDKs work with the base URL set to `https://beta-api.b3os.org/v1/infer`; see [OpenAI and Anthropic compatibility](https://docs.beta.b3os.org/compat/openai) for the differences.
|
|
127
|
+
|
|
128
|
+
## Where the time goes
|
|
129
|
+
|
|
130
|
+
An agent loop alternates model turns with tool calls, and where the agent runs decides what each one pays:
|
|
131
|
+
|
|
132
|
+
| Your agent runs | Model turn | Tool calls |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| In a [B3OS sandbox](https://docs.beta.b3os.org/sandboxes/agents) on the node, on a model served there | `http://127.0.0.1:7700/v1/infer`, on the same machine | On the same machine |
|
|
135
|
+
| Anywhere else, on the node's model | A round trip through the edge at `beta-api.b3os.org` | A round trip through the edge each |
|
|
136
|
+
| Anywhere, on a model from another provider | Wherever that model runs | A round trip through the edge each |
|
|
137
|
+
|
|
138
|
+
Only the first keeps the whole think, act, observe loop on one machine. From anywhere else, every model turn and every tool call pays the edge round trip, which depends on where you are. `Server-Timing` on each response carries the node's own share (`ttft` on streams, `model` otherwise), so the rest of what you measure is the network between you and the node. A locked run of the first setup is published: an agent in a sandbox on the node, on this model, 30 tasks of 12 turns, 5 runs. Its time per turn and per task, with the raw data of every turn, is on [benchmarks](https://docs.beta.b3os.org/benchmarks#headline-results). [Same-host latency](https://docs.beta.b3os.org/concepts/latency) explains the three setups across all products.
|
|
139
|
+
|
|
140
|
+
## Billing and scopes
|
|
141
|
+
|
|
142
|
+
Chat, Responses and Messages bill `infer.input_tokens` and `infer.output_tokens`; speech bills `infer.audio_chars`; counting tokens is free. A request that never reached the model bills nothing, and a stream you abandon bills up to its last token. Inference is free in the beta, within each model's tokens and requests per minute.
|
|
143
|
+
|
|
144
|
+
| Scope | For |
|
|
145
|
+
|---|---|
|
|
146
|
+
| `infer:run` | Chat completions, speech and embeddings |
|
|
147
|
+
| `infer:read` | List models and voices |
|
|
148
|
+
|
|
149
|
+
- [Chat](https://docs.beta.b3os.org/infer/chat)
|
|
150
|
+
Tools, JSON Schema output, streaming.
|
|
151
|
+
- [Speech](https://docs.beta.b3os.org/infer/speech)
|
|
152
|
+
Audio, with word timestamps for captions.
|
|
153
|
+
- [Limits and FAQ](https://docs.beta.b3os.org/infer/limits)
|
|
154
|
+
Rates, sizes and common questions.
|