@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.
Files changed (217) hide show
  1. package/README.md +87 -7
  2. package/assets/b3os-run.py +137 -0
  3. package/assets/skill/b3os/SKILL.md +111 -0
  4. package/dist/commands/_agents.d.ts +14 -0
  5. package/dist/commands/_agents.js +33 -0
  6. package/dist/commands/_agents.js.map +1 -0
  7. package/dist/commands/_common.js +6 -2
  8. package/dist/commands/_common.js.map +1 -1
  9. package/dist/commands/_context.d.ts +49 -0
  10. package/dist/commands/_context.js +260 -0
  11. package/dist/commands/_context.js.map +1 -0
  12. package/dist/commands/_next.d.ts +39 -0
  13. package/dist/commands/_next.js +77 -0
  14. package/dist/commands/_next.js.map +1 -0
  15. package/dist/commands/agent.d.ts +42 -0
  16. package/dist/commands/agent.js +218 -0
  17. package/dist/commands/agent.js.map +1 -0
  18. package/dist/commands/app.d.ts +2 -0
  19. package/dist/commands/app.js +559 -54
  20. package/dist/commands/app.js.map +1 -1
  21. package/dist/commands/auth.d.ts +88 -2
  22. package/dist/commands/auth.js +354 -44
  23. package/dist/commands/auth.js.map +1 -1
  24. package/dist/commands/docs.d.ts +54 -0
  25. package/dist/commands/docs.js +202 -0
  26. package/dist/commands/docs.js.map +1 -0
  27. package/dist/commands/doctor.d.ts +23 -0
  28. package/dist/commands/doctor.js +313 -0
  29. package/dist/commands/doctor.js.map +1 -0
  30. package/dist/commands/init.d.ts +38 -1
  31. package/dist/commands/init.js +259 -60
  32. package/dist/commands/init.js.map +1 -1
  33. package/dist/commands/listen.d.ts +30 -0
  34. package/dist/commands/listen.js +194 -0
  35. package/dist/commands/listen.js.map +1 -0
  36. package/dist/commands/manifest.d.ts +13 -1
  37. package/dist/commands/manifest.js +81 -18
  38. package/dist/commands/manifest.js.map +1 -1
  39. package/dist/commands/mcp.d.ts +25 -2
  40. package/dist/commands/mcp.js +120 -11
  41. package/dist/commands/mcp.js.map +1 -1
  42. package/dist/commands/sandbox.d.ts +35 -6
  43. package/dist/commands/sandbox.js +208 -9
  44. package/dist/commands/sandbox.js.map +1 -1
  45. package/dist/commands/setup.d.ts +39 -0
  46. package/dist/commands/setup.js +203 -0
  47. package/dist/commands/setup.js.map +1 -0
  48. package/dist/commands/tool.d.ts +154 -0
  49. package/dist/commands/tool.js +785 -0
  50. package/dist/commands/tool.js.map +1 -0
  51. package/dist/config.d.ts +30 -6
  52. package/dist/config.js +39 -8
  53. package/dist/config.js.map +1 -1
  54. package/dist/ctx.d.ts +5 -45
  55. package/dist/ctx.js +25 -160
  56. package/dist/ctx.js.map +1 -1
  57. package/dist/docs/index.json +1 -0
  58. package/dist/docs/pages/actions/call.md +300 -0
  59. package/dist/docs/pages/actions/catalog/airtable.md +737 -0
  60. package/dist/docs/pages/actions/catalog/arxiv.md +166 -0
  61. package/dist/docs/pages/actions/catalog/chainalysis-sanctions.md +125 -0
  62. package/dist/docs/pages/actions/catalog/coingecko.md +1558 -0
  63. package/dist/docs/pages/actions/catalog/deps-dev.md +465 -0
  64. package/dist/docs/pages/actions/catalog/dexscreener.md +568 -0
  65. package/dist/docs/pages/actions/catalog/discord.md +784 -0
  66. package/dist/docs/pages/actions/catalog/finnhub.md +776 -0
  67. package/dist/docs/pages/actions/catalog/frankfurter.md +438 -0
  68. package/dist/docs/pages/actions/catalog/github.md +1853 -0
  69. package/dist/docs/pages/actions/catalog/gmail.md +575 -0
  70. package/dist/docs/pages/actions/catalog/google-calendar.md +654 -0
  71. package/dist/docs/pages/actions/catalog/google-drive.md +502 -0
  72. package/dist/docs/pages/actions/catalog/google-sheets.md +700 -0
  73. package/dist/docs/pages/actions/catalog/hacker-news.md +542 -0
  74. package/dist/docs/pages/actions/catalog/http.md +824 -0
  75. package/dist/docs/pages/actions/catalog/hyperliquid.md +942 -0
  76. package/dist/docs/pages/actions/catalog/jira.md +920 -0
  77. package/dist/docs/pages/actions/catalog/kalshi.md +917 -0
  78. package/dist/docs/pages/actions/catalog/linear.md +1030 -0
  79. package/dist/docs/pages/actions/catalog/markets.md +21 -0
  80. package/dist/docs/pages/actions/catalog/morpho.md +247 -0
  81. package/dist/docs/pages/actions/catalog/notion.md +1077 -0
  82. package/dist/docs/pages/actions/catalog/nws.md +485 -0
  83. package/dist/docs/pages/actions/catalog/open-meteo.md +559 -0
  84. package/dist/docs/pages/actions/catalog/polymarket.md +1523 -0
  85. package/dist/docs/pages/actions/catalog/pushbullet.md +220 -0
  86. package/dist/docs/pages/actions/catalog/resend.md +307 -0
  87. package/dist/docs/pages/actions/catalog/s3.md +513 -0
  88. package/dist/docs/pages/actions/catalog/sec-edgar.md +487 -0
  89. package/dist/docs/pages/actions/catalog/slack.md +2629 -0
  90. package/dist/docs/pages/actions/catalog/stripe.md +1405 -0
  91. package/dist/docs/pages/actions/catalog/wikipedia.md +379 -0
  92. package/dist/docs/pages/actions/catalog.md +46 -0
  93. package/dist/docs/pages/actions/limits.md +50 -0
  94. package/dist/docs/pages/actions/model-tools.md +225 -0
  95. package/dist/docs/pages/actions/packs.md +148 -0
  96. package/dist/docs/pages/actions/settings.md +69 -0
  97. package/dist/docs/pages/actions/tools.md +244 -0
  98. package/dist/docs/pages/actions/triggers.md +149 -0
  99. package/dist/docs/pages/actions.md +88 -0
  100. package/dist/docs/pages/compat/anthropic.md +168 -0
  101. package/dist/docs/pages/compat/e2b.md +194 -0
  102. package/dist/docs/pages/compat/firecrawl.md +138 -0
  103. package/dist/docs/pages/compat/openai.md +168 -0
  104. package/dist/docs/pages/concepts/auth.md +151 -0
  105. package/dist/docs/pages/concepts/beta.md +55 -0
  106. package/dist/docs/pages/concepts/glossary.md +71 -0
  107. package/dist/docs/pages/concepts/ids.md +98 -0
  108. package/dist/docs/pages/concepts/jobs.md +229 -0
  109. package/dist/docs/pages/concepts/latency.md +138 -0
  110. package/dist/docs/pages/concepts/limits.md +191 -0
  111. package/dist/docs/pages/concepts/stack.md +59 -0
  112. package/dist/docs/pages/concepts/timing.md +86 -0
  113. package/dist/docs/pages/concepts/usage.md +110 -0
  114. package/dist/docs/pages/design/b3os-yaml.md +370 -0
  115. package/dist/docs/pages/design/deploy-from-github.md +122 -0
  116. package/dist/docs/pages/design/observability.md +134 -0
  117. package/dist/docs/pages/errors.md +1824 -0
  118. package/dist/docs/pages/infer/chat.md +570 -0
  119. package/dist/docs/pages/infer/limits.md +55 -0
  120. package/dist/docs/pages/infer/messages.md +185 -0
  121. package/dist/docs/pages/infer/responses.md +173 -0
  122. package/dist/docs/pages/infer/settings.md +154 -0
  123. package/dist/docs/pages/infer/speech.md +323 -0
  124. package/dist/docs/pages/infer.md +154 -0
  125. package/dist/docs/pages/introduction.md +162 -0
  126. package/dist/docs/pages/platform/addresses.md +174 -0
  127. package/dist/docs/pages/platform/call-log.md +99 -0
  128. package/dist/docs/pages/platform/custom-domains.md +104 -0
  129. package/dist/docs/pages/platform/keys.md +79 -0
  130. package/dist/docs/pages/platform/limits.md +57 -0
  131. package/dist/docs/pages/platform/members.md +101 -0
  132. package/dist/docs/pages/platform/requests.md +116 -0
  133. package/dist/docs/pages/platform/settings.md +129 -0
  134. package/dist/docs/pages/platform/webhooks.md +68 -0
  135. package/dist/docs/pages/platform.md +67 -0
  136. package/dist/docs/pages/quickstart/mcp.md +94 -0
  137. package/dist/docs/pages/quickstart/sandbox-agent.md +205 -0
  138. package/dist/docs/pages/quickstart/scrape.md +134 -0
  139. package/dist/docs/pages/quickstart.md +45 -0
  140. package/dist/docs/pages/render/inspections.md +162 -0
  141. package/dist/docs/pages/render/limits.md +72 -0
  142. package/dist/docs/pages/render/screenshots.md +179 -0
  143. package/dist/docs/pages/render/settings.md +431 -0
  144. package/dist/docs/pages/render/styles.md +342 -0
  145. package/dist/docs/pages/render/videos.md +272 -0
  146. package/dist/docs/pages/render.md +118 -0
  147. package/dist/docs/pages/routines/callables.md +174 -0
  148. package/dist/docs/pages/routines/definitions.md +361 -0
  149. package/dist/docs/pages/routines/limits.md +117 -0
  150. package/dist/docs/pages/routines/runs.md +328 -0
  151. package/dist/docs/pages/routines/settings.md +104 -0
  152. package/dist/docs/pages/routines/triggers.md +339 -0
  153. package/dist/docs/pages/routines.md +216 -0
  154. package/dist/docs/pages/sandboxes/agents.md +217 -0
  155. package/dist/docs/pages/sandboxes/commands.md +272 -0
  156. package/dist/docs/pages/sandboxes/images.md +166 -0
  157. package/dist/docs/pages/sandboxes/limits.md +143 -0
  158. package/dist/docs/pages/sandboxes/ports.md +260 -0
  159. package/dist/docs/pages/sandboxes/settings.md +358 -0
  160. package/dist/docs/pages/sandboxes/snapshots.md +423 -0
  161. package/dist/docs/pages/sandboxes/swarms.md +146 -0
  162. package/dist/docs/pages/sandboxes/volumes.md +131 -0
  163. package/dist/docs/pages/sandboxes.md +231 -0
  164. package/dist/docs/pages/sdks/cli.md +121 -0
  165. package/dist/docs/pages/sdks/mcp.md +169 -0
  166. package/dist/docs/pages/sdks/python.md +146 -0
  167. package/dist/docs/pages/sdks/typescript.md +202 -0
  168. package/dist/docs/pages/sdks.md +282 -0
  169. package/dist/docs/pages/settings.md +33 -0
  170. package/dist/docs/pages/vault/limits.md +46 -0
  171. package/dist/docs/pages/vault.md +133 -0
  172. package/dist/docs/pages/vision/agent-browser.md +115 -0
  173. package/dist/docs/pages/vision/crawl.md +333 -0
  174. package/dist/docs/pages/vision/extract.md +152 -0
  175. package/dist/docs/pages/vision/fetcher.md +15 -0
  176. package/dist/docs/pages/vision/limits.md +79 -0
  177. package/dist/docs/pages/vision/profiles.md +111 -0
  178. package/dist/docs/pages/vision/proxy.md +131 -0
  179. package/dist/docs/pages/vision/scrape.md +356 -0
  180. package/dist/docs/pages/vision/sessions.md +311 -0
  181. package/dist/docs/pages/vision/settings.md +656 -0
  182. package/dist/docs/pages/vision.md +175 -0
  183. package/dist/errors.d.ts +129 -0
  184. package/dist/errors.js +326 -0
  185. package/dist/errors.js.map +1 -0
  186. package/dist/main.d.ts +1 -1
  187. package/dist/main.js +26 -13
  188. package/dist/main.js.map +1 -1
  189. package/dist/manifest/apply.d.ts +4 -0
  190. package/dist/manifest/apply.js +2 -0
  191. package/dist/manifest/apply.js.map +1 -1
  192. package/dist/manifest/domains.d.ts +50 -0
  193. package/dist/manifest/domains.js +159 -0
  194. package/dist/manifest/domains.js.map +1 -0
  195. package/dist/manifest/link.d.ts +20 -0
  196. package/dist/manifest/link.js +24 -0
  197. package/dist/manifest/link.js.map +1 -0
  198. package/dist/manifest/record.d.ts +1 -1
  199. package/dist/tool/archive.d.ts +33 -0
  200. package/dist/tool/archive.js +174 -0
  201. package/dist/tool/archive.js.map +1 -0
  202. package/dist/tool/calls.d.ts +46 -0
  203. package/dist/tool/calls.js +274 -0
  204. package/dist/tool/calls.js.map +1 -0
  205. package/dist/tool/checks.d.ts +21 -0
  206. package/dist/tool/checks.js +145 -0
  207. package/dist/tool/checks.js.map +1 -0
  208. package/dist/tool/elf.d.ts +19 -0
  209. package/dist/tool/elf.js +107 -0
  210. package/dist/tool/elf.js.map +1 -0
  211. package/dist/tool/predict.d.ts +8 -0
  212. package/dist/tool/predict.js +38 -0
  213. package/dist/tool/predict.js.map +1 -0
  214. package/dist/tool/ustar.d.ts +5 -0
  215. package/dist/tool/ustar.js +220 -0
  216. package/dist/tool/ustar.js.map +1 -0
  217. package/package.json +6 -5
@@ -0,0 +1,185 @@
1
+ # Messages
2
+
3
+ > Call the node's model with the Anthropic Messages API from the Anthropic SDKs, including streaming, tool use and extended thinking.
4
+
5
+ Source: https://docs.beta.b3os.org/infer/messages.md
6
+
7
+ `POST /v1/infer/v1/messages` is the Anthropic Messages API on the node's model. Point an Anthropic SDK at `https://beta-api.b3os.org/v1/infer` with your B3OS key as the auth token, and set `B3OS_MODEL` to a chat model from `GET /v1/infer/models` ([setup](https://docs.beta.b3os.org/compat/anthropic)). [Anthropic compatibility](https://docs.beta.b3os.org/compat/anthropic) lists every field the node supports, ignores or refuses.
8
+
9
+ ## Streaming
10
+
11
+ **TypeScript**
12
+
13
+ ```ts
14
+ import Anthropic from "@anthropic-ai/sdk";
15
+
16
+ const client = new Anthropic({ authToken: process.env.B3OS_API_KEY, baseURL: "https://beta-api.b3os.org/v1/infer" });
17
+ const stream = client.messages.stream({
18
+ model: process.env.B3OS_MODEL!,
19
+ max_tokens: 256,
20
+ messages: [{ role: "user", content: "Count from 1 to 5." }],
21
+ });
22
+ stream.on("text", (text) => process.stdout.write(text));
23
+ const message = await stream.finalMessage();
24
+ console.log("\n", message.usage);
25
+ ```
26
+ **Python**
27
+
28
+ ```python
29
+ import os
30
+ import anthropic
31
+
32
+ client = anthropic.Anthropic(auth_token=os.environ["B3OS_API_KEY"], base_url="https://beta-api.b3os.org/v1/infer")
33
+ with client.messages.stream(
34
+ model=os.environ["B3OS_MODEL"],
35
+ max_tokens=256,
36
+ messages=[{"role": "user", "content": "Count from 1 to 5."}],
37
+ ) as stream:
38
+ for text in stream.text_stream:
39
+ print(text, end="", flush=True)
40
+ print("\n", stream.get_final_message().usage)
41
+ ```
42
+ **curl**
43
+
44
+ ```bash
45
+ curl -sN https://beta-api.b3os.org/v1/infer/v1/messages \
46
+ -H "Authorization: Bearer $B3OS_API_KEY" \
47
+ -H "anthropic-version: 2023-06-01" \
48
+ -H "Content-Type: application/json" \
49
+ -d "{\"model\": \"$B3OS_MODEL\", \"max_tokens\": 256, \"stream\": true, \"messages\": [{\"role\": \"user\", \"content\": \"Count from 1 to 5.\"}]}"
50
+ ```
51
+
52
+ The events are Anthropic's: `message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta` and `message_stop`. A stream that fails after it started ends with an `error` event; one that fails before the first token is a plain HTTP error. `Server-Timing` carries `ttft`, the time to the first generated token on the node.
53
+
54
+ ## Tool use
55
+
56
+ Define custom tools with `input_schema`. When the model wants one it stops with `stop_reason: "tool_use"`; run the tool and send its output back as a `tool_result` block in the next user turn.
57
+
58
+ **Python**
59
+
60
+ ```python
61
+ tools = [{
62
+ "name": "get_weather",
63
+ "description": "Current weather for a city.",
64
+ "input_schema": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
65
+ }]
66
+ messages = [{"role": "user", "content": "What is the weather in Eugene, Oregon? Use the tool."}]
67
+ first = client.messages.create(model=os.environ["B3OS_MODEL"], max_tokens=512, tools=tools, messages=messages)
68
+ call = next(b for b in first.content if b.type == "tool_use")
69
+ messages += [
70
+ {"role": "assistant", "content": first.content},
71
+ {"role": "user", "content": [{"type": "tool_result", "tool_use_id": call.id, "content": "52F and raining"}]},
72
+ ]
73
+ answer = client.messages.create(model=os.environ["B3OS_MODEL"], max_tokens=512, tools=tools, messages=messages)
74
+ print(answer.content[-1].text)
75
+ ```
76
+ **TypeScript**
77
+
78
+ ```ts
79
+ const tools: Anthropic.Tool[] = [{
80
+ name: "get_weather",
81
+ description: "Current weather for a city.",
82
+ input_schema: { type: "object", properties: { city: { type: "string" } }, required: ["city"] },
83
+ }];
84
+ const messages: Anthropic.MessageParam[] = [
85
+ { role: "user", content: "What is the weather in Eugene, Oregon? Use the tool." },
86
+ ];
87
+ const first = await client.messages.create({ model: process.env.B3OS_MODEL!, max_tokens: 512, tools, messages });
88
+ const call = first.content.find((b) => b.type === "tool_use")!;
89
+ messages.push(
90
+ { role: "assistant", content: first.content },
91
+ { role: "user", content: [{ type: "tool_result", tool_use_id: call.id, content: "52F and raining" }] },
92
+ );
93
+ const answer = await client.messages.create({ model: process.env.B3OS_MODEL!, max_tokens: 512, tools, messages });
94
+ console.log(answer.content.at(-1));
95
+ ```
96
+
97
+ `tool_choice` takes `auto`, `any`, `none` or `{"type": "tool", "name": ...}`, with `disable_parallel_tool_use`. Tools Anthropic runs on its side (`web_search`, `bash`, `code_execution` and the like) are refused: the node runs custom tools only.
98
+
99
+ ## Extended thinking
100
+
101
+ `thinking` with `type: "enabled"` turns the model's reasoning on; `budget_tokens` (at least 1,024, and below `max_tokens`) caps it. The reasoning comes back in `thinking` blocks before the answer, and goes back with its turn when you continue the conversation.
102
+
103
+ ```python
104
+ message = client.messages.create(
105
+ model=os.environ["B3OS_MODEL"],
106
+ max_tokens=4096,
107
+ thinking={"type": "enabled", "budget_tokens": 1024},
108
+ messages=[{"role": "user", "content": "Is 391 prime?"}],
109
+ )
110
+ for block in message.content:
111
+ print(block.type, block.thinking if block.type == "thinking" else block.text)
112
+ ```
113
+
114
+ A budget that does not fit below `max_tokens` is refused before the model runs:
115
+
116
+ **Response 400**
117
+
118
+ ```json
119
+ {
120
+ "b3os": {
121
+ "code": "invalid_request",
122
+ "param": "thinking.budget_tokens"
123
+ },
124
+ "error": {
125
+ "message": "must be less than max_tokens",
126
+ "type": "invalid_request_error"
127
+ },
128
+ "request_id": "req_01m6am1azrn50qxbeehzwqa12g",
129
+ "type": "error"
130
+ }
131
+ ```
132
+
133
+ **Request**
134
+
135
+ ```bash
136
+ curl -s -X POST 'https://beta-api.b3os.org/v1/infer/v1/messages' \
137
+ -H "Authorization: Bearer $B3OS_API_KEY" \
138
+ -H 'content-type: application/json' \
139
+ -H 'anthropic-version: 2023-06-01' \
140
+ -d '{"model":"b3os/qwen3.5-9b","max_tokens":1024,"thinking":{"type":"enabled","budget_tokens":1024},"messages":[{"role":"user","content":"Is 391 prime?"}]}'
141
+ ```
142
+
143
+ **Server-Timing**
144
+
145
+ ```http
146
+ server-timing: edge_auth;dur=0.000, edge_upstream;dur=13.000, total;dur=0.242
147
+ x-request-id: req_01m6am1azrn50qxbeehzwqa12g
148
+ ```
149
+
150
+ <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/messages-thinking-budget`.</sub>
151
+
152
+ `adaptive` turns the reasoning on with no budget (only `max_tokens` bounds it), and `disabled`, the default, answers without reasoning. `output_config.effort` is accepted and has no effect.
153
+
154
+ ## Long sessions
155
+
156
+ The node clears nothing from a conversation. `context_management` (context editing) is accepted and ignored, so every turn you send stays in the prompt, and a long agent session grows until the prompt no longer fits the model's 32,768-token context. That request gets `400` [`context_length_exceeded`](https://docs.beta.b3os.org/errors#context_length_exceeded). Summarize or drop old turns in your client before then; `POST /v1/infer/v1/messages/count_tokens` tells you a request's size for free.
157
+
158
+ Instructions go in the top-level `system` parameter. A `system` message inside `messages`, which some agents send in the middle of a session, is refused with `400` [`invalid_request`](https://docs.beta.b3os.org/errors#invalid_request) rather than moved, because moving it would change what the model reads at that turn. Fold such instructions into the next user turn, or into `system` when the session starts.
159
+
160
+ ## Prompt logging
161
+
162
+ When the project keeps model calls ([prompt logging](https://docs.beta.b3os.org/platform/call-log), off by default), this call's request and answer are kept on the node for 7 days with keys removed. `b3os.capture` in the answer (the last chunk of a stream) says what applied: `{"value": "off", "from": "node", "clamped": false}`, and so does the `X-B3OS-Options` header. Send `X-B3OS-Capture-Content: off` to keep nothing of one call; no header turns it on.
163
+
164
+ ## Limits
165
+
166
+ Messages share chat completions' admission and limits: the estimated prompt plus `max_tokens` counts against your organization's tokens per minute for the model, and requests per minute and requests in flight apply. Going over answers `429` [`rate_limited`](https://docs.beta.b3os.org/errors#rate_limited) with `Retry-After`. See [Infer limits](https://docs.beta.b3os.org/infer/limits). Input and output tokens are metered as `infer.input_tokens` and `infer.output_tokens`.
167
+
168
+ ```json
169
+ {
170
+ "model": "b3os/qwen3.5-9b",
171
+ "max_tokens": 512,
172
+ "messages": [{ "role": "user", "content": "What is the weather in Eugene, Oregon? Use the tool." }],
173
+ "tools": [
174
+ {
175
+ "name": "get_weather",
176
+ "description": "Current weather for a city.",
177
+ "input_schema": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] }
178
+ }
179
+ ]
180
+ }
181
+ ```
182
+
183
+ [Try it in the playground](https://beta.b3os.org/app/playground?op=inferCreateMessage&body=eyJtb2RlbCI6ImIzb3MvcXdlbjMuNS05YiIsIm1heF90b2tlbnMiOjUxMiwibWVzc2FnZXMiOlt7InJvbGUiOiJ1c2VyIiwiY29udGVudCI6IldoYXQgaXMgdGhlIHdlYXRoZXIgaW4gRXVnZW5lLCBPcmVnb24_IFVzZSB0aGUgdG9vbC4ifV0sInRvb2xzIjpbeyJuYW1lIjoiZ2V0X3dlYXRoZXIiLCJkZXNjcmlwdGlvbiI6IkN1cnJlbnQgd2VhdGhlciBmb3IgYSBjaXR5LiIsImlucHV0X3NjaGVtYSI6eyJ0eXBlIjoib2JqZWN0IiwicHJvcGVydGllcyI6eyJjaXR5Ijp7InR5cGUiOiJzdHJpbmcifX0sInJlcXVpcmVkIjpbImNpdHkiXX19XX0)
184
+
185
+ <sub>Opens the dashboard playground with this request filled in (`POST /v1/infer/v1/messages`). The link carries no key.</sub>
@@ -0,0 +1,173 @@
1
+ # Responses
2
+
3
+ > Call the node's model with the OpenAI Responses API, statelessly, from the OpenAI SDKs, the OpenAI Agents SDK and Codex.
4
+
5
+ Source: https://docs.beta.b3os.org/infer/responses.md
6
+
7
+ `POST /v1/infer/responses` is the OpenAI Responses API on the node's model, with the same base URL as chat completions, `https://beta-api.b3os.org/v1/infer`. Set `B3OS_MODEL` to a chat model from `GET /v1/infer/models` first ([how](https://docs.beta.b3os.org/compat/openai)).
8
+
9
+ The node stores nothing. Send the whole conversation as `input` items on every turn; `previous_response_id`, `conversation`, stored prompts and background mode are refused with `400` [`unsupported_parameter`](https://docs.beta.b3os.org/errors#unsupported_parameter).
10
+
11
+ ## A response
12
+
13
+ **TypeScript**
14
+
15
+ ```ts
16
+ import OpenAI from "openai";
17
+
18
+ const client = new OpenAI({ apiKey: process.env.B3OS_API_KEY, baseURL: "https://beta-api.b3os.org/v1/infer" });
19
+ const response = await client.responses.create({
20
+ model: process.env.B3OS_MODEL!,
21
+ instructions: "You are a concise assistant.",
22
+ input: "Name one river in Oregon.",
23
+ });
24
+ console.log(response.output_text, response.usage);
25
+ ```
26
+ **Python**
27
+
28
+ ```python
29
+ import os
30
+ from openai import OpenAI
31
+
32
+ client = OpenAI(api_key=os.environ["B3OS_API_KEY"], base_url="https://beta-api.b3os.org/v1/infer")
33
+ response = client.responses.create(
34
+ model=os.environ["B3OS_MODEL"],
35
+ instructions="You are a concise assistant.",
36
+ input="Name one river in Oregon.",
37
+ )
38
+ print(response.output_text, response.usage)
39
+ ```
40
+ **curl**
41
+
42
+ ```bash
43
+ curl -s https://beta-api.b3os.org/v1/infer/responses \
44
+ -H "Authorization: Bearer $B3OS_API_KEY" \
45
+ -H "Content-Type: application/json" \
46
+ -d "{\"model\": \"$B3OS_MODEL\", \"instructions\": \"You are a concise assistant.\", \"input\": \"Name one river in Oregon.\"}"
47
+ ```
48
+
49
+ `stream: true` sends the Responses event stream: `response.created`, the output item, content part and `response.output_text.delta` events, `response.function_call_arguments.delta` for tool calls, and `response.completed` (or `response.incomplete` at `max_output_tokens`). The SDKs' `responses.stream(...)` helpers read it.
50
+
51
+ ## Function tools, statelessly
52
+
53
+ Each turn sends the conversation so far: the earlier input, the output items the model returned, and a `function_call_output` for every call.
54
+
55
+ ```python
56
+ tools = [{
57
+ "type": "function",
58
+ "name": "get_weather",
59
+ "description": "Current weather for a city.",
60
+ "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
61
+ }]
62
+ question = {"role": "user", "content": "What is the weather in Eugene, Oregon? Use the tool."}
63
+ first = client.responses.create(model=os.environ["B3OS_MODEL"], input=[question], tools=tools)
64
+ call = next(o for o in first.output if o.type == "function_call")
65
+ follow = [
66
+ question,
67
+ *[o.model_dump(exclude_unset=True) for o in first.output],
68
+ {"type": "function_call_output", "call_id": call.call_id, "output": "52F and raining"},
69
+ ]
70
+ answer = client.responses.create(model=os.environ["B3OS_MODEL"], input=follow, tools=tools)
71
+ print(answer.output_text)
72
+ ```
73
+
74
+ An output sent without the call it answers (as a client that expects the server to remember the last response would send it) is refused, naming the item:
75
+
76
+ **Response 400**
77
+
78
+ ```json
79
+ {
80
+ "error": {
81
+ "code": "invalid_request",
82
+ "message": "no function_call with call_id \"call_weather_1\" comes before this output",
83
+ "param": "input.1.call_id",
84
+ "type": "invalid_request_error"
85
+ }
86
+ }
87
+ ```
88
+
89
+ **Request**
90
+
91
+ ```bash
92
+ curl -s -X POST 'https://beta-api.b3os.org/v1/infer/responses' \
93
+ -H "Authorization: Bearer $B3OS_API_KEY" \
94
+ -H 'content-type: application/json' \
95
+ -d '{"model":"b3os/qwen3.5-9b","input":[{"role":"user","content":"What is the weather in Eugene, Oregon? Use the tool."},{"type":"function_call_output","call_id":"call_weather_1","output":"52F and raining"}]}'
96
+ ```
97
+
98
+ **Server-Timing**
99
+
100
+ ```http
101
+ server-timing: edge_auth;dur=0.000, edge_upstream;dur=13.000, total;dur=0.182
102
+ x-request-id: req_01m6am1b3d02bcz9cm2zypyx69
103
+ ```
104
+
105
+ <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/responses-unanswered-output`.</sub>
106
+
107
+ `tool_choice` takes `none`, `auto`, `required` or a named function, and `text.format` takes `json_schema` for structured output. A tool's `strict` reaches the model's runtime only when you set it, and the response's `tools` echo what was applied: your value, or `null` when unset. OpenAI defaults it to `true`; here an unset `strict` leaves `auto` tool calls unconstrained, so set `"strict": true` when the arguments must match the schema. `reasoning.effort` from `low` up turns the model's reasoning on; it comes back as `reasoning` items, which go back with their turn. Tools OpenAI runs on its side (web search, file search, computer use, code interpreter, MCP, image generation, shell) are refused with `400` [`unsupported_parameter`](https://docs.beta.b3os.org/errors#unsupported_parameter).
108
+
109
+ ## OpenAI Agents SDK
110
+
111
+ The Agents SDK uses Responses by default. Give it a client pointed at the node and a model object: a model string with a slash (`b3os/...`) is read as a provider prefix and fails with `Unknown prefix: b3os`. Turn tracing off, or the SDK sends traces to OpenAI.
112
+
113
+ ```python
114
+ import asyncio
115
+ import os
116
+
117
+ from agents import Agent, OpenAIResponsesModel, Runner, function_tool, set_tracing_disabled
118
+ from openai import AsyncOpenAI
119
+
120
+ client = AsyncOpenAI(api_key=os.environ["B3OS_API_KEY"], base_url="https://beta-api.b3os.org/v1/infer")
121
+ set_tracing_disabled(True)
122
+
123
+ @function_tool
124
+ def get_weather(city: str) -> str:
125
+ """Current weather for a city."""
126
+ return "52F and raining"
127
+
128
+ agent = Agent(
129
+ name="Weather",
130
+ instructions="Answer with the tool's result.",
131
+ model=OpenAIResponsesModel(model=os.environ["B3OS_MODEL"], openai_client=client),
132
+ tools=[get_weather],
133
+ )
134
+ print(asyncio.run(Runner.run(agent, "What is the weather in Eugene, Oregon? Use the tool.")).final_output)
135
+ ```
136
+
137
+ ## Codex
138
+
139
+ Codex talks to a custom provider over Responses. Add the node as a provider in `~/.codex/config.toml`, with your key in `B3OS_API_KEY`:
140
+
141
+ ```toml
142
+ model = "b3os/qwen3.5-9b"
143
+ model_provider = "b3os"
144
+
145
+ [model_providers.b3os]
146
+ name = "B3OS"
147
+ base_url = "https://beta-api.b3os.org/v1/infer"
148
+ env_key = "B3OS_API_KEY"
149
+ wire_api = "responses"
150
+ supports_websockets = false
151
+ ```
152
+
153
+ `supports_websockets = false` keeps Codex on HTTPS, the only transport the node serves for Responses: a WebSocket upgrade on `/v1/infer/responses` is answered at once with `405` (`Allow: POST`). Inside a B3OS sandbox, set `base_url = "http://127.0.0.1:7700/v1/infer"`.
154
+
155
+ ## Prompt logging
156
+
157
+ When the project keeps model calls ([prompt logging](https://docs.beta.b3os.org/platform/call-log), off by default), this call's request and answer are kept on the node for 7 days with keys removed. `b3os.capture` in the answer (the last chunk of a stream) says what applied: `{"value": "off", "from": "node", "clamped": false}`, and so does the `X-B3OS-Options` header. Send `X-B3OS-Capture-Content: off` to keep nothing of one call; no header turns it on.
158
+
159
+ ## Limits
160
+
161
+ Responses share chat completions' admission and limits: the estimated input plus `max_output_tokens` counts against your organization's tokens per minute for the model, with requests per minute and requests in flight. Going over answers `429` [`rate_limited`](https://docs.beta.b3os.org/errors#rate_limited) with `Retry-After`; a prompt longer than the context answers `400` [`context_length_exceeded`](https://docs.beta.b3os.org/errors#context_length_exceeded). See [Infer limits](https://docs.beta.b3os.org/infer/limits). Errors use OpenAI's shape.
162
+
163
+ ```json
164
+ {
165
+ "model": "b3os/qwen3.5-9b",
166
+ "instructions": "You are a concise assistant.",
167
+ "input": "Name one river in Oregon."
168
+ }
169
+ ```
170
+
171
+ [Try it in the playground](https://beta.b3os.org/app/playground?op=inferCreateResponse&body=eyJtb2RlbCI6ImIzb3MvcXdlbjMuNS05YiIsImluc3RydWN0aW9ucyI6IllvdSBhcmUgYSBjb25jaXNlIGFzc2lzdGFudC4iLCJpbnB1dCI6Ik5hbWUgb25lIHJpdmVyIGluIE9yZWdvbi4ifQ)
172
+
173
+ <sub>Opens the dashboard playground with this request filled in (`POST /v1/infer/responses`). The link carries no key.</sub>
@@ -0,0 +1,154 @@
1
+ # Infer settings
2
+
3
+ > Every infer setting: routing, output cap, reasoning, sampling and speech, with defaults, values and examples, and what is fixed in the beta.
4
+
5
+ Source: https://docs.beta.b3os.org/infer/settings.md
6
+
7
+ These are fields of the chat completions, Responses and speech requests. Most follow OpenAI's API, so an OpenAI client sends them as it always does; `route` and the runtime extensions are B3OS's. [Chat completions](https://docs.beta.b3os.org/infer/chat) explains each in context.
8
+
9
+ | Setting | Default |
10
+ |---|---|
11
+ | [Gateway route](#gateway-route): `route` | `local` |
12
+ | [Output cap](#output-cap): `max_tokens` | the model's `b3os.default_max_tokens`; `null` there means no cap |
13
+ | [Reasoning](#reasoning): `reasoning_effort` | `none` |
14
+ | [Sampling](#sampling): `temperature` | unset, so the runtime's own applies |
15
+ | [Audio format](#audio-format): `response_format` | `mp3` |
16
+ | [Speed](#speed): `speed` | 1 |
17
+ | [Word timings](#word-timings): `timestamps` | `none` |
18
+ | [Streaming](#streaming): `stream_format` | unset: the clip comes in one piece |
19
+
20
+ ## Chat
21
+
22
+ ### Gateway route
23
+
24
+ `local` answers only with a model this node serves; an unknown model is `404 model_not_available`. `gateway` sends a model the node does not serve to the B3IQ gateway. The beta node has no gateway route configured, so `gateway` answers the same 404 there. B3OS never sends a request elsewhere on its own.
25
+
26
+ - **Field:** `route` on [chat](https://docs.beta.b3os.org/api/post-v1-infer-chat-completions)
27
+ - **Default:** `local`
28
+ - **Values:** `local` or `gateway`
29
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
30
+ - **Guide:** [No silent fallback](https://docs.beta.b3os.org/infer#no-silent-fallback)
31
+
32
+ ```json
33
+ {"model": "b3os/default", "messages": [{"role": "user", "content": "Name three rivers."}], "route": "gateway"}
34
+ ```
35
+
36
+ ### Output cap
37
+
38
+ The most tokens to generate. The answer stops there with `finish_reason: "length"`. With no cap from the request or the node, it can run to the end of the context. `max_completion_tokens` wins over `max_tokens`. `GET /v1/infer/models` shows each model's default cap.
39
+
40
+ - **Field:** `max_tokens`, `max_completion_tokens` and `max_output_tokens` on [chat](https://docs.beta.b3os.org/api/post-v1-infer-chat-completions) and [responses](https://docs.beta.b3os.org/api/post-v1-infer-responses)
41
+ - **Default:** the model's `b3os.default_max_tokens`; `null` there means no cap
42
+ - **Values:** 1 or more
43
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request), [`400 context_length_exceeded`](https://docs.beta.b3os.org/errors#context_length_exceeded)
44
+ - **Guide:** [Models](https://docs.beta.b3os.org/infer#models)
45
+
46
+ ```json
47
+ {"model": "b3os/default", "messages": [{"role": "user", "content": "Name three rivers."}], "max_tokens": 512}
48
+ ```
49
+
50
+ ```bash
51
+ b3os infer chat "Name three rivers" --max-tokens 512
52
+ ```
53
+
54
+ ### Reasoning
55
+
56
+ How long the model may reason before it answers. `low`, `medium`, `high` and `xhigh` allow at most 256, 1,024, 4,096 and 8,192 reasoning tokens; at the budget the node closes the reasoning and the answer follows in the same request. Reasoning tokens count as output tokens.
57
+
58
+ - **Field:** `reasoning_effort` and `reasoning.effort` on [chat](https://docs.beta.b3os.org/api/post-v1-infer-chat-completions) and [responses](https://docs.beta.b3os.org/api/post-v1-infer-responses)
59
+ - **Default:** `none`
60
+ - **Values:** `none`, `minimal`, `low`, `medium`, `high` or `xhigh`
61
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
62
+ - **Guide:** [Reasoning](https://docs.beta.b3os.org/infer/chat#reasoning)
63
+
64
+ ```json
65
+ {"model": "b3os/default", "messages": [{"role": "user", "content": "Name three rivers."}], "reasoning_effort": "low"}
66
+ ```
67
+
68
+ ### Sampling
69
+
70
+ How the next token is picked. Lower `temperature` and `top_p` make answers more repeatable; the penalties discourage repeating tokens. `top_k`, `min_p` and `repetition_penalty` are runtime extensions that OpenAI clients pass through `extra_body`.
71
+
72
+ - **Field:** `temperature`, `top_p`, `top_k`, `min_p`, `repetition_penalty`, `presence_penalty` and `frequency_penalty` on [chat](https://docs.beta.b3os.org/api/post-v1-infer-chat-completions) and [responses](https://docs.beta.b3os.org/api/post-v1-infer-responses)
73
+ - **Default:** unset, so the runtime's own applies
74
+ - **Values:** 0 to 2 (`temperature`, chat); 0 to 1 (`top_p`, chat); -1 to 1,000,000 (`top_k`, chat); 0 to 1 (`min_p`, chat); 0 to 2 (`repetition_penalty`, chat); -2 to 2 (`presence_penalty`, chat); -2 to 2 (`frequency_penalty`, chat); 0 to 2 (`temperature`, responses); 0 to 1 (`top_p`, responses)
75
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
76
+
77
+ ```json
78
+ {"model": "b3os/default", "messages": [{"role": "user", "content": "Name three rivers."}], "temperature": 0.2, "top_p": 0.9}
79
+ ```
80
+
81
+ ## Speech
82
+
83
+ ### Audio format
84
+
85
+ The encoding of the clip. `pcm` and `wav` start fastest to play; `mp3` and `opus` are smaller.
86
+
87
+ - **Field:** `response_format` on [speech](https://docs.beta.b3os.org/api/post-v1-infer-audio-speech)
88
+ - **Default:** `mp3`
89
+ - **Values:** `mp3`, `opus`, `aac`, `flac`, `wav` or `pcm`
90
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
91
+ - **Guide:** [Speech](https://docs.beta.b3os.org/infer/speech)
92
+
93
+ ```json
94
+ {"model": "kokoro-82m", "input": "Hello.", "voice": "af_heart", "response_format": "wav"}
95
+ ```
96
+
97
+ ```bash
98
+ b3os infer speech "Hello" --out hello.wav --response-format wav
99
+ ```
100
+
101
+ ### Speed
102
+
103
+ How fast the voice speaks.
104
+
105
+ - **Field:** `speed` on [speech](https://docs.beta.b3os.org/api/post-v1-infer-audio-speech)
106
+ - **Default:** 1
107
+ - **Values:** 0.25 to 4; `kokoro-82m` speaks at 0.5 to 2; outside a model's range is `400 unsupported_parameter`, never clamped
108
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request), [`400 unsupported_parameter`](https://docs.beta.b3os.org/errors#unsupported_parameter)
109
+
110
+ ```json
111
+ {"model": "kokoro-82m", "input": "Hello.", "voice": "af_heart", "speed": 1.2}
112
+ ```
113
+
114
+ ```bash
115
+ b3os infer speech "Hello" --out hello.mp3 --speed 1.2
116
+ ```
117
+
118
+ ### Word timings
119
+
120
+ `word` returns JSON with the audio as base64 and each word's start and end time, for captions or lip sync.
121
+
122
+ - **Field:** `timestamps` on [speech](https://docs.beta.b3os.org/api/post-v1-infer-audio-speech)
123
+ - **Default:** `none`
124
+ - **Values:** `none` or `word`
125
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
126
+
127
+ ```json
128
+ {"model": "kokoro-82m", "input": "Hello.", "voice": "af_heart", "timestamps": "word"}
129
+ ```
130
+
131
+ ### Streaming
132
+
133
+ `audio` streams the bytes of `response_format` as they are made; `sse` streams events with base64 audio. A stream starts playing sooner.
134
+
135
+ - **Field:** `stream_format` on [speech](https://docs.beta.b3os.org/api/post-v1-infer-audio-speech)
136
+ - **Default:** unset: the clip comes in one piece
137
+ - **Values:** `audio` or `sse`
138
+ - **Invalid value:** [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
139
+
140
+ ```json
141
+ {"model": "kokoro-82m", "input": "Hello.", "voice": "af_heart", "stream_format": "audio", "response_format": "pcm"}
142
+ ```
143
+
144
+ ## Fixed in the beta
145
+
146
+ These work one way in the beta, and no request field changes them.
147
+
148
+ ### Cached tokens and the token limit
149
+
150
+ **Counted in full.** Prompt tokens the runtime serves from its prefix cache count in full toward your tokens-per-minute limit (`tpm`), the same as any other prompt token. They are billed as `infer.input_tokens` like the rest.
151
+
152
+ ### Precision
153
+
154
+ **FP8.** The chat model runs in an FP8 quantization. A different precision would be a different model ID; the model list shows each model's `quantization`.