@b3os/cli 0.2.1 → 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 -8
- 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 -5
- package/dist/commands/app.js +229 -69
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/auth.d.ts +70 -2
- package/dist/commands/auth.js +308 -33
- 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 +59 -7
- 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 +109 -1
- package/dist/commands/tool.js +635 -47
- package/dist/commands/tool.js.map +1 -1
- 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/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,168 @@
|
|
|
1
|
+
# Anthropic compatibility
|
|
2
|
+
|
|
3
|
+
> Use the Anthropic SDKs and the Messages API with the model served on the B3OS node; which request fields are supported, accepted and ignored, or refused.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/compat/anthropic.md
|
|
6
|
+
|
|
7
|
+
`/v1/infer` also speaks the Anthropic Messages API, on the same model as the [OpenAI routes](https://docs.beta.b3os.org/compat/openai). The Anthropic SDKs work with two changes: the base URL, and your B3OS key as the credential.
|
|
8
|
+
|
|
9
|
+
| Where your code runs | Base URL | Key |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Anywhere | `https://beta-api.b3os.org/v1/infer` | Your B3OS key |
|
|
12
|
+
| Inside a B3OS sandbox | `http://127.0.0.1:7700/v1/infer` | Not checked; pass any string |
|
|
13
|
+
|
|
14
|
+
The SDKs add `/v1/messages`, so requests go to `/v1/infer/v1/messages`. The key works as a bearer token (`ANTHROPIC_AUTH_TOKEN`, `authToken`, `auth_token`) and as `x-api-key` (`ANTHROPIC_API_KEY`), so SDK releases that send either header authenticate.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
export ANTHROPIC_BASE_URL="https://beta-api.b3os.org/v1/infer"
|
|
18
|
+
export ANTHROPIC_AUTH_TOKEN="$B3OS_API_KEY"
|
|
19
|
+
export B3OS_MODEL=$(curl -s https://beta-api.b3os.org/v1/infer/models \
|
|
20
|
+
-H "Authorization: Bearer $B3OS_API_KEY" | jq -r '[.data[] | select(.b3os.kind == "chat")][0].id')
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**curl**
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
curl -s https://beta-api.b3os.org/v1/infer/v1/messages \
|
|
27
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
28
|
+
-H "anthropic-version: 2023-06-01" \
|
|
29
|
+
-H "Content-Type: application/json" \
|
|
30
|
+
-d "{\"model\": \"$B3OS_MODEL\", \"max_tokens\": 256, \"messages\": [{\"role\": \"user\", \"content\": \"Name one river in Oregon.\"}]}"
|
|
31
|
+
```
|
|
32
|
+
**TypeScript**
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
36
|
+
|
|
37
|
+
const client = new Anthropic({
|
|
38
|
+
authToken: process.env.B3OS_API_KEY,
|
|
39
|
+
baseURL: "https://beta-api.b3os.org/v1/infer",
|
|
40
|
+
});
|
|
41
|
+
const message = await client.messages.create({
|
|
42
|
+
model: process.env.B3OS_MODEL!,
|
|
43
|
+
max_tokens: 256,
|
|
44
|
+
messages: [{ role: "user", content: "Name one river in Oregon." }],
|
|
45
|
+
});
|
|
46
|
+
console.log(message.content, message.usage);
|
|
47
|
+
```
|
|
48
|
+
**Python**
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import os
|
|
52
|
+
import anthropic
|
|
53
|
+
|
|
54
|
+
client = anthropic.Anthropic(
|
|
55
|
+
auth_token=os.environ["B3OS_API_KEY"],
|
|
56
|
+
base_url="https://beta-api.b3os.org/v1/infer",
|
|
57
|
+
)
|
|
58
|
+
message = client.messages.create(
|
|
59
|
+
model=os.environ["B3OS_MODEL"],
|
|
60
|
+
max_tokens=256,
|
|
61
|
+
messages=[{"role": "user", "content": "Name one river in Oregon."}],
|
|
62
|
+
)
|
|
63
|
+
print(message.content, message.usage)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
[Messages](https://docs.beta.b3os.org/infer/messages) shows streaming, tools and thinking with both SDKs.
|
|
67
|
+
|
|
68
|
+
## Request fields
|
|
69
|
+
|
|
70
|
+
**Supported**
|
|
71
|
+
|
|
72
|
+
| Field | On this node |
|
|
73
|
+
|---|---|
|
|
74
|
+
| `model`, `max_tokens` | Both required. `max_tokens` caps the answer, and admission reserves it against your token limit |
|
|
75
|
+
| `messages` | `text`, `image` (`base64`, or a `url` source the node fetches through its egress guard), `tool_use`, `tool_result` and `thinking` blocks. A trailing assistant turn that ends in text is continued |
|
|
76
|
+
| `system` | A string or text blocks, joined with blank lines |
|
|
77
|
+
| `tools`, `tool_choice` | Custom tools (`name`, `description`, `input_schema`, `strict`), up to 128; `tool_choice` `auto`, `any`, `tool` or `none`, with `disable_parallel_tool_use` |
|
|
78
|
+
| `thinking` | `enabled` with `budget_tokens` (from 1,024, below `max_tokens`), `adaptive` or `disabled`. The node closes the reasoning at the budget and the answer follows; `adaptive` reasons within `output_config.effort`'s budget (`low` 256, `medium` 1,024, `high` 4,096, `xhigh` and `max` 8,192 tokens; `high` when unset). The reasoning comes back in `thinking` blocks |
|
|
79
|
+
| `output_config.format` | JSON Schema output (`json_schema`) |
|
|
80
|
+
| `output_config.effort` | The reasoning budget of adaptive `thinking` (above); no effect without it |
|
|
81
|
+
| `stop_sequences` | Up to 4 |
|
|
82
|
+
| `temperature`, `top_p`, `top_k` | Passed to the model's runtime (`temperature` and `top_p` from 0 to 1). Older SDK releases and agents still send them, so they are kept |
|
|
83
|
+
| `stream` | The Messages event stream, `message_start` to `message_stop` |
|
|
84
|
+
|
|
85
|
+
`POST /v1/infer/v1/messages/count_tokens` counts a request's input tokens with the model's own chat template, for free.
|
|
86
|
+
|
|
87
|
+
**Accepted and ignored**
|
|
88
|
+
|
|
89
|
+
| Field | Why |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `cache_control`, on any block or tool | The runtime caches prompt prefixes on its own, per organization. `usage.cache_read_input_tokens` says how much of the prompt the cache served and `input_tokens` is the rest; `cache_creation_input_tokens` is 0, since nothing is written on request. When streaming, the split comes in `message_delta`: `message_start` gives the whole prompt as `input_tokens` with no cache fields (the runtime reports the cached part only at the end), and the Anthropic SDKs' final usage takes `message_delta`'s values |
|
|
92
|
+
| `context_management` | Nothing is cleared from the conversation: the model sees every turn you send (see [long sessions](https://docs.beta.b3os.org/infer/messages#long-sessions)) |
|
|
93
|
+
| `citations` on text blocks, `metadata.user_id`, `service_tier` | No effect on this node |
|
|
94
|
+
| `thinking.display` | The reasoning is always returned |
|
|
95
|
+
|
|
96
|
+
**Refused** with `400` and the B3OS code [`unsupported_parameter`](https://docs.beta.b3os.org/errors#unsupported_parameter), naming the field
|
|
97
|
+
|
|
98
|
+
| Field | Why |
|
|
99
|
+
|---|---|
|
|
100
|
+
| Tools Anthropic defines or runs (`web_search`, `bash`, `code_execution`, `computer`, `text_editor` and the like) | The node runs custom tools only |
|
|
101
|
+
| `mcp_servers`, `container` | Not available on this node |
|
|
102
|
+
| `document` blocks and `file` sources (the Files API) | Send text, or the image as base64 or a URL |
|
|
103
|
+
| Any other field | The request is closed, as Anthropic refuses extra inputs |
|
|
104
|
+
|
|
105
|
+
A `system` message inside `messages` is refused too (`400`, [`invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)): instructions go in the top-level `system`.
|
|
106
|
+
|
|
107
|
+
## Errors
|
|
108
|
+
|
|
109
|
+
Errors use Anthropic's shape, `{"type": "error", "error": {"type", "message"}}`, with the B3OS code and the offending field under `b3os`. That holds for errors raised before the request reaches the model service too (authentication, scopes, body size), on the node and at the edge, so the SDKs raise the same exception classes they raise for Anthropic's API. Nothing maps another provider's model name to the node's model, so code that names a Claude model gets a `404`:
|
|
110
|
+
|
|
111
|
+
**Response 404**
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"b3os": {
|
|
116
|
+
"code": "model_not_available",
|
|
117
|
+
"param": "model"
|
|
118
|
+
},
|
|
119
|
+
"error": {
|
|
120
|
+
"message": "claude-sonnet-4-5 is not served on this node; GET /v1/infer/models lists the models that are",
|
|
121
|
+
"type": "not_found_error"
|
|
122
|
+
},
|
|
123
|
+
"request_id": "req_01m6am1b12cd8z85fcxvypa1mf",
|
|
124
|
+
"type": "error"
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Request**
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
curl -s -X POST 'https://beta-api.b3os.org/v1/infer/v1/messages' \
|
|
132
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
133
|
+
-H 'content-type: application/json' \
|
|
134
|
+
-H 'anthropic-version: 2023-06-01' \
|
|
135
|
+
-d '{"model":"claude-sonnet-4-5","max_tokens":256,"messages":[{"role":"user","content":"Name one river in Oregon."}]}'
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Server-Timing**
|
|
139
|
+
|
|
140
|
+
```http
|
|
141
|
+
server-timing: edge_auth;dur=16.000, edge_upstream;dur=12.000, total;dur=0.086
|
|
142
|
+
x-request-id: req_01m6am1b12cd8z85fcxvypa1mf
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
<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-unknown-model`.</sub>
|
|
146
|
+
|
|
147
|
+
| Status (`error.type`) | When |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `400 invalid_request_error` | A malformed value ([`invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)), a refused field, or a prompt longer than the model's context ([`context_length_exceeded`](https://docs.beta.b3os.org/errors#context_length_exceeded)) |
|
|
150
|
+
| `401 authentication_error` | No key, or a key that is not valid |
|
|
151
|
+
| `403 permission_error` | A key without the `infer:run` scope, or an image URL on a private address ([`egress_denied`](https://docs.beta.b3os.org/errors#egress_denied)) |
|
|
152
|
+
| `404 not_found_error` | A model the node does not serve ([`model_not_available`](https://docs.beta.b3os.org/errors#model_not_available)); there is no gateway route here |
|
|
153
|
+
| `429 rate_limit_error` | Over your organization's tokens or requests per minute ([`rate_limited`](https://docs.beta.b3os.org/errors#rate_limited)), with `Retry-After` |
|
|
154
|
+
| `503 overloaded_error` | The model runtime is restarting or busy ([`infer_backend_unavailable`](https://docs.beta.b3os.org/errors#infer_backend_unavailable)), with `Retry-After` |
|
|
155
|
+
|
|
156
|
+
Per-model token and request limits are on [Infer limits](https://docs.beta.b3os.org/infer/limits).
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"model": "b3os/qwen3.5-9b",
|
|
161
|
+
"max_tokens": 256,
|
|
162
|
+
"messages": [{ "role": "user", "content": "Name one river in Oregon." }]
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
[Try it in the playground](https://beta.b3os.org/app/playground?op=inferCreateMessage&body=eyJtb2RlbCI6ImIzb3MvcXdlbjMuNS05YiIsIm1heF90b2tlbnMiOjI1NiwibWVzc2FnZXMiOlt7InJvbGUiOiJ1c2VyIiwiY29udGVudCI6Ik5hbWUgb25lIHJpdmVyIGluIE9yZWdvbi4ifV19)
|
|
167
|
+
|
|
168
|
+
<sub>Opens the dashboard playground with this request filled in (`POST /v1/infer/v1/messages`). The link carries no key.</sub>
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# E2B compatibility
|
|
2
|
+
|
|
3
|
+
> Run code written for the e2b SDKs on B3OS microVMs by changing three environment variables; what works, what is refused, and how the envd access token is kept.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/compat/e2b.md
|
|
6
|
+
|
|
7
|
+
B3OS serves E2B's sandbox API and envd, the daemon inside each sandbox, at `/compat/e2b`, with E2B's field names, status codes and error bodies. Code written for the e2b 2.62 SDKs (TypeScript and Python) creates B3OS microVMs and runs commands and file calls in them with three environment variables changed:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
export E2B_API_KEY="$B3OS_API_KEY"
|
|
11
|
+
export E2B_API_URL="https://beta-api.b3os.org/compat/e2b"
|
|
12
|
+
export E2B_SANDBOX_URL="https://beta-api.b3os.org/compat/e2b/envd"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The sandboxes underneath are the native ones: a sandbox created here is listed, billed and limited like any other, and the [native API](https://docs.beta.b3os.org/sandboxes) works on it too (fork, snapshot, ports, `run_code`). The key needs `sandboxes:read`, `sandboxes:write` and `sandboxes:run`.
|
|
16
|
+
|
|
17
|
+
## Clients
|
|
18
|
+
|
|
19
|
+
**curl**
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
curl -s https://beta-api.b3os.org/compat/e2b/v2/sandboxes \
|
|
23
|
+
-H "X-API-KEY: $B3OS_API_KEY" \
|
|
24
|
+
-H 'content-type: application/json' \
|
|
25
|
+
-d '{"templateID": "base", "timeout": 300, "metadata": {"run": "e2b"}}'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The answer holds `sandboxID` (the B3OS ID in its DNS-safe form, `sbx-…`) and `envdAccessToken`, which envd calls send as `X-Access-Token` with `E2b-Sandbox-Id: <sandboxID>`.
|
|
29
|
+
**TypeScript**
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install e2b@2.62.0
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { Sandbox } from "e2b";
|
|
37
|
+
|
|
38
|
+
const sandbox = await Sandbox.create({ timeoutMs: 300_000 });
|
|
39
|
+
const result = await sandbox.commands.run('echo "Hello from E2B Sandbox!"');
|
|
40
|
+
console.log(result.stdout);
|
|
41
|
+
await sandbox.files.write("/home/user/hello.txt", "Hello");
|
|
42
|
+
console.log(await sandbox.files.read("/home/user/hello.txt"));
|
|
43
|
+
await sandbox.kill();
|
|
44
|
+
```
|
|
45
|
+
**Python**
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install e2b==2.62.0
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from e2b import Sandbox
|
|
53
|
+
|
|
54
|
+
sandbox = Sandbox.create(timeout=300)
|
|
55
|
+
result = sandbox.commands.run('echo "Hello from E2B Sandbox!"')
|
|
56
|
+
print(result.stdout)
|
|
57
|
+
sandbox.files.write("/home/user/hello.txt", "Hello")
|
|
58
|
+
print(sandbox.files.read("/home/user/hello.txt"))
|
|
59
|
+
sandbox.kill()
|
|
60
|
+
```
|
|
61
|
+
**CLI**
|
|
62
|
+
|
|
63
|
+
The same microVM through the B3OS CLI, which speaks the native API:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
b3os sandbox create --template base --timeout-s 300
|
|
67
|
+
b3os sandbox exec sbx_01m5t68q1b590rj801nbzsqzkk -- echo "Hello from B3OS"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Where it stands: the e2b 2.62.0 TypeScript and Python quickstarts in the repository's `bench/sandboxes/e2b` (create, commands with exit codes and streamed output, files, the process calls, list, get, timeout, pause, connect, kill, and the refusals below) passed against `beta-api.b3os.org` on 2026-11-02 with only the three variables set: all 23 TypeScript steps and all 11 Python steps (`bench/sandboxes/results/20261102T2058Z-e2b-quickstart-prod`).
|
|
71
|
+
|
|
72
|
+
## Frameworks
|
|
73
|
+
|
|
74
|
+
These agent frameworks run on B3OS through their own E2B backend, with the three variables above and the agent's model on the node's [OpenAI-compatible API](https://docs.beta.b3os.org/compat/openai). In a run against `beta-api.b3os.org` on 2026-11-14, from the node's own host, each framework's tool loop on `b3os/qwen3.5-9b` ran `uname -a` in a sandbox, wrote the output to `/home/user/proof.txt`, read it back and answered with its first word (`bench/sandboxes/results/20261114T101650Z-e2b-frameworks-prod`). AG2 and Google ADK met the pass rule in `bench/sandboxes/e2b/frameworks/README.md` on the second attempt: in the first, the model's first call was `uname -a > /home/user/proof.txt`, and the rule counts `uname` only when its own result shows `Linux`.
|
|
75
|
+
|
|
76
|
+
| Framework | Version | On B3OS | Settings |
|
|
77
|
+
|---|---|---|---|
|
|
78
|
+
| AG2 | `ag2` 1.3.1 | `E2BEnvironment` behind `SandboxShellTool`: the agent's shell commands | The three variables. Model: `OpenAICompletionsConfig(base_url=...)` |
|
|
79
|
+
| Google ADK | `google-adk` 2.13.0 | `E2BEnvironment` behind `EnvironmentToolset`: `Execute`, `WriteFile`, `ReadFile` | The three variables. Model: `LiteLlm(model="openai/b3os/qwen3.5-9b", api_base=...)` on `litellm` 1.106.2; the run needed the `litellm[mcp]` extra. The run's `adk.py` adds a wire log, a metadata tag (a wrapper on `AsyncSandbox.create`) and `LITELLM_LOCAL_MODEL_COST_MAP=True`, so LiteLLM uses its bundled price list instead of fetching one from GitHub; none of the three changes where the sandbox points |
|
|
80
|
+
|
|
81
|
+
The AG2 lines (the run's `bench/sandboxes/e2b/frameworks/ag2.py` adds a wire log, a metadata tag and, after the answer, a verify read: `cat /home/user/proof.txt` through the same `E2BEnvironment`):
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install "ag2[openai]==1.3.1" "openai==3.45.0" "e2b==2.62.0"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import asyncio
|
|
89
|
+
import os
|
|
90
|
+
|
|
91
|
+
from ag2 import Agent
|
|
92
|
+
from ag2.config import OpenAICompletionsConfig
|
|
93
|
+
from ag2.extensions.e2b import E2BEnvironment
|
|
94
|
+
from ag2.tools import SandboxShellTool
|
|
95
|
+
|
|
96
|
+
async def main():
|
|
97
|
+
env = E2BEnvironment(sandbox_timeout=300)
|
|
98
|
+
agent = Agent(
|
|
99
|
+
"agent",
|
|
100
|
+
"You work in a remote Linux sandbox through your tools. Use a tool for every step; never guess an output.",
|
|
101
|
+
config=OpenAICompletionsConfig(
|
|
102
|
+
model="b3os/qwen3.5-9b",
|
|
103
|
+
api_key=os.environ["B3OS_API_KEY"],
|
|
104
|
+
base_url="https://beta-api.b3os.org/v1/infer",
|
|
105
|
+
),
|
|
106
|
+
tools=[SandboxShellTool(env)],
|
|
107
|
+
)
|
|
108
|
+
try:
|
|
109
|
+
reply = await agent.ask(
|
|
110
|
+
"Run uname -a in the sandbox, write the output to /home/user/proof.txt, "
|
|
111
|
+
"read it back, and answer with its first word."
|
|
112
|
+
)
|
|
113
|
+
print(reply.body)
|
|
114
|
+
finally:
|
|
115
|
+
await env.aclose()
|
|
116
|
+
|
|
117
|
+
asyncio.run(main())
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The model's tool calls, what each returned, and the answer, from `ag2.json` in that run:
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
run_shell_command uname -a
|
|
124
|
+
Linux sbx-01m7cryqkcvhw3sb5pbp4gynph 6.1.188 #1 SMP PREEMPT_DYNAMIC Fri Oct 23 16:17:47 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
|
|
125
|
+
run_shell_command uname -a > /home/user/proof.txt
|
|
126
|
+
run_shell_command cat /home/user/proof.txt
|
|
127
|
+
Linux sbx-01m7cryqkcvhw3sb5pbp4gynph 6.1.188 #1 SMP PREEMPT_DYNAMIC Fri Oct 23 16:17:47 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
|
|
128
|
+
The first word of the output is **Linux**.
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Pydantic AI Harness and TanStack AI finished the same task, but on B3OS they lose exit codes: see [What is refused](#what-is-refused).
|
|
132
|
+
|
|
133
|
+
## What works
|
|
134
|
+
|
|
135
|
+
| SDK call | On B3OS |
|
|
136
|
+
|---|---|
|
|
137
|
+
| `Sandbox.create` | Templates `base` (the default), `code-interpreter` and `agent` ([templates](https://docs.beta.b3os.org/sandboxes#templates)), with `envs`, `metadata`, `timeoutMs` and `lifecycle.onTimeout: "pause"`. A retry with the SDK's `Idempotency-Key` returns the same sandbox |
|
|
138
|
+
| `Sandbox.list`, `Sandbox.getInfo` | Running and paused sandboxes, with E2B's `metadata` and `state` filters and `nextToken` pages |
|
|
139
|
+
| `setTimeout`, `pause`, `Sandbox.connect`, `kill` | As in E2B: `connect` resumes a paused sandbox and returns a new envd access token |
|
|
140
|
+
| `commands.run`, `commands.start`, `background: true`, `onStdout`, `onStderr` | A process belongs to the sandbox, so closing the stream leaves it running; `commands.connect` streams it again from its start |
|
|
141
|
+
| `cwd`, `user` | As in E2B: a command starts in `cwd` (`~` and `~/x` are the user's home, a relative path starts there), else in the home of the user it runs as (`/home/user`, `/root` with `user: "root"`). A `cwd` that does not exist is refused with `cwd '<path>' does not exist` (`envd_probe` on production, 2026-11-15, sandbox `sbx-01m7gh4scpvnmzy14gbdvcgmqb`) |
|
|
142
|
+
| `commands.list`, `commands.kill` | Processes started through envd |
|
|
143
|
+
| `files.read`, `files.write`, `files.writeFiles`, `files.list` (with `depth` up to 8), `files.exists`, `files.getInfo`, `files.makeDir`, `files.rename`, `files.remove` | Relative paths start at the user's home (`/home/user`; `/root` with `user: "root"`) |
|
|
144
|
+
| `network.allowOut` with `denyOut: ["0.0.0.0/0"]`, or `allowInternetAccess: false` | B3OS egress: only the named hosts (`example.com`, `*.example.com`, `host:port`), or nothing |
|
|
145
|
+
|
|
146
|
+
## What is refused
|
|
147
|
+
|
|
148
|
+
A create, pause or connect option B3OS cannot honor answers `400` naming the field ([`unsupported_option`](https://docs.beta.b3os.org/errors#unsupported_option)). A body member B3OS does not read is accepted and ignored, so a field a later SDK release adds does not fail the call.
|
|
149
|
+
|
|
150
|
+
| Option | Instead |
|
|
151
|
+
|---|---|
|
|
152
|
+
| `mcp` | Run your MCP server as a process in the sandbox (`commands.run` with `background: true`) |
|
|
153
|
+
| `lifecycle.autoResume` | Resume a paused sandbox with `Sandbox.connect` |
|
|
154
|
+
| `volumeMounts` | Keep files in the sandbox and save it with a [snapshot](https://docs.beta.b3os.org/sandboxes/snapshots) |
|
|
155
|
+
| `iam`, and `network` fields other than `allowOut` and `denyOut` | Not in the beta |
|
|
156
|
+
| `onTimeout.mode: "filesystem"`, `pause` without memory, `connect` with `onResume: "reboot"` | A paused sandbox always keeps its memory |
|
|
157
|
+
|
|
158
|
+
envd refuses two options with Connect's `invalid_argument`, naming the option, and one with `400`:
|
|
159
|
+
|
|
160
|
+
| Option | Instead |
|
|
161
|
+
|---|---|
|
|
162
|
+
| `commands.run` with `stdin: true` | Pass input in the command (a here-document or a file) |
|
|
163
|
+
| `sandbox.pty` | Open a terminal with the native `GET /v1/sandboxes/{sandbox_id}/pty` |
|
|
164
|
+
| `files.write` with gzip (`400`) | Send the file uncompressed |
|
|
165
|
+
|
|
166
|
+
One envd behavior differs from E2B's (`envd-probe.json` in the frameworks run):
|
|
167
|
+
|
|
168
|
+
- Each command leads its own session, so `setsid` forks and exits `0` at once, and output written after that is lost. Use `setsid -w`, or no `setsid`.
|
|
169
|
+
|
|
170
|
+
Two frameworks trip on it and on the stdin refusal, so they run in part:
|
|
171
|
+
|
|
172
|
+
| Framework | What works | What is refused |
|
|
173
|
+
|---|---|---|
|
|
174
|
+
| Pydantic AI Harness, `pydantic-ai-harness[e2b]` 0.64.0 | `Shell`'s `run_command` ran the command, wrote the file with `>` and read it with `cat` | The backend's `run` reports exit code `0` for `exit 5` (`envd-probe.json`, `harness_run_exit_5`). `FileSystem`'s `write_file` answers "`/home/user/proof.txt` is outside the project root `/workspace`", also with `E2BSandbox(working_dir="/home/user")`, and the harness's file read raises "FIFO reads are not supported" for a plain file: the read first runs `test -p` on the path through the same `run`, which reports `0` |
|
|
175
|
+
| TanStack AI, `@tanstack/ai-sandbox-e2b` 1.0.0 | The task ran through three tools the bench wrote, `exec`, `write_file` and `read_file`, thin wrappers over the handle's `process.exec`, `fs.write` and `fs.read`, because TanStack ships no exec tool for a text adapter. `fs.write`, `fs.read`, and `process.exec` of a command that prints at once work | The handle runs every command, `process.exec` and `process.spawn` alike, as `exec setsid bash -c`, so `exit 5` reports exit code `0` and `sleep 1; echo late` returns no output. `process.spawn` opens stdin and gets `[invalid_argument] stdin: true is not supported by B3OS envd; pass input in the command (a here-document or a file)` |
|
|
176
|
+
|
|
177
|
+
Template builds (`Template.build`, `POST /v3/templates`) answer [`501 not_implemented`](https://docs.beta.b3os.org/errors#not_implemented) with the alternative: start from a built-in template, install what you need, and create from a snapshot. `files.watchDir` and `getMetrics` are not served and answer `404` in E2B's shape.
|
|
178
|
+
|
|
179
|
+
## The envd access token
|
|
180
|
+
|
|
181
|
+
envd calls carry no API key, only the sandbox's envd access token, so B3OS keeps it under these rules:
|
|
182
|
+
|
|
183
|
+
- It is `b3os_et_` followed by 32 random bytes. The node keeps only its SHA-256 in the sandbox's record; nothing else stores it.
|
|
184
|
+
- Only the create and connect answers return it, never a list or get answer or the native API.
|
|
185
|
+
- It works while the sandbox is running or paused, for at most an hour from issue, and while the key that minted it is not revoked. Kill, delete and the timeout end it at once.
|
|
186
|
+
- `Sandbox.connect` mints a new one, bound to the connecting key; the previous one keeps working for a minute, then never again.
|
|
187
|
+
- Forks and sandboxes restored from a snapshot start without a token: `Sandbox.connect` gives them their own.
|
|
188
|
+
- It grants what `sandboxes:run` grants on that one sandbox (commands and files), as the key that minted it.
|
|
189
|
+
|
|
190
|
+
Every refused envd call gets the same `401` with [`envd_token_invalid`](https://docs.beta.b3os.org/errors#envd_token_invalid) in the message, whether the token is missing, wrong, expired or rotated out, or the sandbox is missing, ended or another organization's.
|
|
191
|
+
|
|
192
|
+
E2B's signed file URLs (`downloadUrl` and `uploadUrl` in TypeScript, `download_url` and `upload_url` in Python) are not supported: the node keeps no token it could check a signature with, so a request carrying `signature` or `signature_expiration` gets that `401`. Read and write files through `files.read` and `files.write`.
|
|
193
|
+
|
|
194
|
+
Plan limits apply as to native sandboxes: see [sandbox limits](https://docs.beta.b3os.org/sandboxes/limits).
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Firecrawl compatibility
|
|
2
|
+
|
|
3
|
+
> Point a Firecrawl SDK, the Firecrawl MCP server or LangChain's loader at B3OS by changing the base URL and key; which endpoints work and which do not.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/compat/firecrawl.md
|
|
6
|
+
|
|
7
|
+
B3OS vision serves Firecrawl's v1 and v2 HTTP APIs at `/compat/firecrawl`, with Firecrawl's field names, defaults, status codes, pagination, error bodies and webhook payloads. Code written for Firecrawl needs two changes: the base URL and the key.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
export FIRECRAWL_API_URL="https://beta-api.b3os.org/compat/firecrawl"
|
|
11
|
+
export FIRECRAWL_API_KEY="$B3OS_API_KEY"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The key needs `vision:run` and `vision:read`: the SDKs read a crawl, batch or extract job's status, the parse formats list and the usage endpoints with `vision:read`, and without it those calls answer `403`. The json format, crawl `prompt`, params preview and `extract` call the node's model and also need `infer:run`.
|
|
15
|
+
|
|
16
|
+
How each client takes the base URL:
|
|
17
|
+
|
|
18
|
+
| Client | Base URL |
|
|
19
|
+
|---|---|
|
|
20
|
+
| firecrawl-js, the Firecrawl MCP server | `https://beta-api.b3os.org/compat/firecrawl`: they keep the path |
|
|
21
|
+
| firecrawl-py 4.x (`Firecrawl`, its v2 methods), LangChain's `FireCrawlLoader` | `https://beta-api.b3os.org`. firecrawl-py: api_url is the host with no path. It joins `/v2/...` onto the host and drops any path, and B3OS serves `/v2/*` at the host as Firecrawl's v2, the same as `/compat/firecrawl/v2/*`. LangChain's loader (langchain-community 0.4.2) builds this client |
|
|
22
|
+
| firecrawl-py's v1 methods (`firecrawl.v1`, `V1FirecrawlApp`) | `https://beta-api.b3os.org/compat/firecrawl`: the v1 client keeps the path. `/v1` at the host is B3OS's own API |
|
|
23
|
+
|
|
24
|
+
Inside a B3OS sandbox, use `http://127.0.0.1:7700/compat/firecrawl` instead, or `http://127.0.0.1:7700` for firecrawl-py's v2 methods; the key is not checked there, so any placeholder works. The node serves `/v2` at its root from the node release that carries it (see the [changelog](https://docs.beta.b3os.org/changelog)); on an older node those calls answer `404`.
|
|
25
|
+
|
|
26
|
+
## Clients
|
|
27
|
+
|
|
28
|
+
**TypeScript**
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import Firecrawl from "@mendable/firecrawl-js";
|
|
32
|
+
|
|
33
|
+
const firecrawl = new Firecrawl({
|
|
34
|
+
apiKey: process.env.B3OS_API_KEY,
|
|
35
|
+
apiUrl: "https://beta-api.b3os.org/compat/firecrawl",
|
|
36
|
+
});
|
|
37
|
+
const doc = await firecrawl.scrape("https://example.com", { formats: ["markdown"] });
|
|
38
|
+
console.log(doc.markdown);
|
|
39
|
+
```
|
|
40
|
+
**Python**
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
import os
|
|
44
|
+
from firecrawl import Firecrawl
|
|
45
|
+
|
|
46
|
+
# firecrawl-py drops the path of api_url: give it the host alone.
|
|
47
|
+
firecrawl = Firecrawl(
|
|
48
|
+
api_key=os.environ["B3OS_API_KEY"],
|
|
49
|
+
api_url="https://beta-api.b3os.org",
|
|
50
|
+
)
|
|
51
|
+
doc = firecrawl.scrape("https://example.com", formats=["markdown"])
|
|
52
|
+
print(doc.markdown)
|
|
53
|
+
```
|
|
54
|
+
**Firecrawl MCP**
|
|
55
|
+
|
|
56
|
+
In Claude Code's `.mcp.json`, which fills in `${B3OS_API_KEY}` from the environment when it starts the server, so the file holds no key (Cursor writes it `${env:B3OS_API_KEY}`):
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"mcpServers": {
|
|
61
|
+
"firecrawl": {
|
|
62
|
+
"command": "npx",
|
|
63
|
+
"args": ["-y", "firecrawl-mcp"],
|
|
64
|
+
"env": {
|
|
65
|
+
"FIRECRAWL_API_URL": "https://beta-api.b3os.org/compat/firecrawl",
|
|
66
|
+
"FIRECRAWL_API_KEY": "${B3OS_API_KEY}"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
**LangChain**
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
import os
|
|
76
|
+
from langchain_community.document_loaders import FireCrawlLoader
|
|
77
|
+
|
|
78
|
+
# The loader uses firecrawl-py's v2 client, which drops the path: give it the host alone.
|
|
79
|
+
loader = FireCrawlLoader(
|
|
80
|
+
url="https://example.com",
|
|
81
|
+
api_key=os.environ["B3OS_API_KEY"],
|
|
82
|
+
api_url="https://beta-api.b3os.org",
|
|
83
|
+
mode="scrape",
|
|
84
|
+
)
|
|
85
|
+
docs = loader.load()
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The release gate for this surface is that the firecrawl-js and firecrawl-py end-to-end tests, the Firecrawl MCP server and LangChain's `FireCrawlLoader` work with only the base URL and key changed. On 2026-11-18 they ran against production on node release 1116, with a key holding `vision:run`, `vision:read` and `infer:run`: firecrawl-js 4.54.0 passed 49 of its 56 v2 end-to-end tests, firecrawl-py 4.57.0 passed 91 of 109 (one skipped), the Firecrawl MCP server 3.40.0 completed 7 of 9 tool calls, and LangChain's `FireCrawlLoader` (langchain-community 0.4.2) loaded in 5 of 5 modes. That run came before node release 1117, which fixed two of its failures: the `summary` format returned no summary, and a URL without a scheme answered `400 invalid_url`. The other failures were options B3OS refuses by name (listed below), firecrawl-py's token usage (in the table below), two request keys the MCP server adds to every search (`toolDetail` and `domainTools`), and tests that assume Firecrawl's hosted service is slower than B3OS's cache.
|
|
89
|
+
|
|
90
|
+
A real deploy that scrapes with firecrawl-py 4.55.0 (GPT Researcher, 2026-11-10) found the two faults this page now covers: the dropped base path and `fastMode`.
|
|
91
|
+
|
|
92
|
+
## Endpoints
|
|
93
|
+
|
|
94
|
+
| Endpoint (v1 and v2) | Status |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `POST /scrape` | Served |
|
|
97
|
+
| `POST /batch/scrape`, `GET` and `DELETE /batch/scrape/{id}`, `GET /batch/scrape/{id}/errors` | Served |
|
|
98
|
+
| `POST /crawl`, `GET` and `DELETE /crawl/{id}`, `GET /crawl/{id}/errors`, `GET /crawl/active` | Served |
|
|
99
|
+
| `POST /map` | Served |
|
|
100
|
+
| `POST /search` | Served by [vision search](https://docs.beta.b3os.org/vision/crawl#search-the-web): web results only, `limit` up to 20, `tbs` for the past day, week, month or year (`qdr:d` to `qdr:y`), and each result's page when `scrapeOptions.formats` names a format. Each result has its `position` from 1. A scraped page whose Markdown came back empty has `empty_page:` in its `warning`, as does the answer: `warning` is every warning joined with `; `, so it can follow another. `country` and `safe` (`true`: strict SafeSearch, `false`: off) go to the search. `location`, `categories`, non-empty `includeDomains` and `excludeDomains` (there is no domain filter: put `site:` or `-site:` in the query), `enterprise` with `anon` or `zdr`, `threatProtection`, other `sources` and the json and summary formats answer `400 unsupported_option`; empty domain lists and an `enterprise` of `[]` or `["default"]` ask for nothing and are accepted. `toolDetail` is accepted and changes nothing, and `highlights: true` gets a `warning` that no highlights are generated; `domainTools: true`, and `alexandria` beside `web` in `sources` (the Firecrawl MCP server adds both to every search it makes with an API key), are accepted, and the answer's `warning` says no tools are listed: B3OS has no provider tool catalog |
|
|
101
|
+
| `GET /team/credit-usage` | Served |
|
|
102
|
+
| `GET /team/token-usage` | Served. B3OS bills the model's tokens as used (free in the beta) and sells no tokens ahead, so `remainingTokens` and `planTokens` are `0`. That limits nothing: extract, the `json` and `summary` formats and crawl prompts run on, within the model's per-minute token rate |
|
|
103
|
+
| v2 `GET /team/queue-status`, v2 `GET /concurrency-check` | Served from your project's jobs and your `vision.scrape.concurrent` limit: `concurrency` is your scrapes in flight now |
|
|
104
|
+
| `POST /extract`, `GET /extract/{id}` | Served by a [vision extract job](https://docs.beta.b3os.org/vision/extract) with the node's model: `schema` (zod schemas work: the SDK sends them as JSON Schema) is validated, `showSources` returns the pages each top-level field came from as `sources`, `systemPrompt` is added to the instructions, and `creditsUsed` and `tokensUsed` count the pages and the model's tokens. A required field no page states ends the job `failed`, with `error` naming it. URL globs (`/*`), `enableWebSearch: true`, `agent`, `threatProtection` and `allowExternalLinks: true` answer `400 unsupported_option` |
|
|
105
|
+
| v2 `POST /crawl/params-preview` and crawl `prompt` | Served: the node's model turns the prompt into `includePaths`, `excludePaths`, `maxDiscoveryDepth`, `crawlEntireDomain`, `allowSubdomains`, `allowExternalLinks` and `sitemap`. Parameters you set win; `GET /crawl/active` shows the chosen ones in `options.promptParams`. Needs `infer:run` and bills the model's tokens |
|
|
106
|
+
| v2 `POST /parse`, `GET /parse/formats` | Served: a `multipart/form-data` upload of an HTML, Markdown, text or PDF file (up to 50 MiB) comes back as a scrape's document with `sourceURL` `file://<name>`; one credit, or one per PDF page read. Other types answer `415 unsupported_media_type` |
|
|
107
|
+
|
|
108
|
+
Every other Firecrawl endpoint answers `404` with code `unsupported_endpoint` and names the B3OS alternative:
|
|
109
|
+
|
|
110
|
+
| Firecrawl endpoint | Use instead |
|
|
111
|
+
|---|---|
|
|
112
|
+
| v2 `POST /agent`, v1 `POST /deep-research` | Run your agent in a [B3OS sandbox](https://docs.beta.b3os.org/quickstart/sandbox-agent) and let it scrape. |
|
|
113
|
+
| v2 `interact`, `scrape/{jobId}/interact` | [Browser sessions](https://docs.beta.b3os.org/vision/sessions): create one, then `act` or connect over CDP. |
|
|
114
|
+
| v2 `GET /scrape/{jobId}` | B3OS scrapes are synchronous; the document is in the `scrape` response. |
|
|
115
|
+
| v1 `GET /crawl/{id}/params` | `GET /v1/vision/crawls/{crawl_id}` returns the crawl as B3OS ran it. |
|
|
116
|
+
| v2 `monitor` | A [routine](https://docs.beta.b3os.org/routines) with a cron trigger and a `vision/scrape@1` step. |
|
|
117
|
+
| v1 `llmstxt` | `map` the site and scrape the pages you need. |
|
|
118
|
+
| The `historical` usage endpoints | [`GET /v1/usage`](https://docs.beta.b3os.org/concepts/usage), grouped by day. |
|
|
119
|
+
| v1 `team/queue-status` | [`GET /v1/limits`](https://docs.beta.b3os.org/concepts/limits), which shows current concurrency against each limit. |
|
|
120
|
+
|
|
121
|
+
## Wire format
|
|
122
|
+
|
|
123
|
+
- Every successful body includes `success: true`. Errors use Firecrawl's shape, `{"success": false, "error": "...", "code": "..."}`, and a `400` for an invalid body adds `details`. Each B3OS error has its Firecrawl status, `code` and `error` prefix on the [errors page](https://docs.beta.b3os.org/errors).
|
|
124
|
+
- Unknown body fields are rejected with `400` and Zod-style `details`, as Firecrawl does. The `origin` and `integration` fields the SDKs add to every request are accepted and ignored, and so are `fastMode` and `useMock` on v2, which firecrawl-py adds to any scrape options it sends.
|
|
125
|
+
- An option B3OS cannot honor returns `400` with code `unsupported_option` naming it. The ones refused today in scrape options (a scrape, a batch, and the `scrapeOptions` of a crawl, search or extract): the `changeTracking` format and `changeTrackingOptions`; the `rawBase64`, `branding`, `product`, `menu`, `audio`, `video`, `attributes`, `question` and `highlights` formats; `actions` of type `pdf`, a `screenshot` action with a `viewport` (the screenshot format takes one) and a `click` action with `all`; `proxy: "enhanced"` or `"stealth"` (the Firecrawl surface does not map proxies yet; the native scrape takes [`proxy`](https://docs.beta.b3os.org/vision/proxy)); in `parsers` any parser but `pdf`, and a PDF parser with `mode: "ocr"` or `blocks: true` (there is no OCR yet); `onlyCleanContent: true`, `checkPromptInjection: true`, `redactPII`, `threatProtection` and v2 `alexandria` (Firecrawl's catalogued provider tools, run instead of a scrape). Batch `appendToId` and crawl `robotsUserAgent` are refused too; the search and extract options refused are in [the table above](#endpoints). Accepted and change nothing: `skipTlsVerification` (B3OS always checks certificates; see [what vision fixes in the beta](https://docs.beta.b3os.org/vision/settings#fixed-in-the-beta)) and v2 `toolDetail`. v2 `domainTools: true` is accepted and the page is the same; its `warning` says no tools are listed. In the `scrapeOptions` of a crawl or extract, or in a batch scrape, the start answer's `warning` says it.
|
|
126
|
+
- A URL without a scheme (`docs.firecrawl.dev`, `example.com:8080/a`) is read as `http://docs.firecrawl.dev`, on scrape, crawl, map, batch scrape and extract, by Firecrawl's own rule: anything that does not start with `name://` gets `http://` in front, and an https site redirects. It goes through the same egress checks as an explicit URL, so a private or loopback address is refused the same way. Text that is no URL even then (`foo bar`) answers `400 invalid_url`. The native API takes absolute `http` and `https` URLs only.
|
|
127
|
+
- PDFs are read from their text layer, as a [native scrape reads them](https://docs.beta.b3os.org/vision/scrape#read-a-pdf): `parsers: ["pdf"]` (the default) or a PDF parser object (`maxPages`, `pageMarkers`, `pages`), and v1 `parsePDF`. A `maxPages` above the node's cap (`vision.pdf.pages_max`, 500) reads the cap, with a warning on a longer file, where a native scrape answers `422 limit_exceeded`. `parsers: []` and `parsePDF: false` leave PDFs unread (`422 content_type_unsupported`), as Firecrawl's "do not parse" does. Page markers are off by default here, as in Firecrawl. `metadata.numPages` is the pages read, `totalPages` the file's page count, and `creditsUsed` one per page read. Formats that need a model (`json`, `summary`) need the node's model; see [extraction](https://docs.beta.b3os.org/vision/scrape). The v2 `summary` format asks it the way `json` does (your `infer:run`, the model's tokens billed) and returns `data.summary`; on a node without a model there is no `summary`, and `warning` says why.
|
|
128
|
+
- Cancelling a batch or crawl that already finished answers `409`, as Firecrawl's own API does.
|
|
129
|
+
- No request is held longer than 60 seconds: a larger `timeout` is treated as 60000. Long work belongs in crawl and batch jobs. Crawl `limit` is capped at your plan's crawl limit and map `limit` at 5000.
|
|
130
|
+
- `next` pagination URLs are absolute and keep the `/compat/firecrawl/v1` or `/v2` prefix; the SDKs keep the path and swap in your base URL. Both prefixes answer whether you call `/compat/firecrawl/v2/...` or `/v2/...`.
|
|
131
|
+
- `x-idempotency-key` works like `Idempotency-Key`.
|
|
132
|
+
- Webhooks will use Firecrawl's payloads and `X-Firecrawl-Signature: sha256=<hex>`, signed with the B3OS [webhook secret](https://docs.beta.b3os.org/platform/webhooks) of the receiving URL. In this beta they are accepted and validated but [not delivered yet](https://docs.beta.b3os.org/concepts/jobs#webhooks), while native vision jobs deliver theirs.
|
|
133
|
+
- The SDKs' job watchers (a WebSocket on a crawl or batch status URL) work through `beta-api.b3os.org`: the SDK sends the key as a WebSocket subprotocol, and the API reads it there.
|
|
134
|
+
- B3OS additions appear only in `data.metadata.b3os` and in the `Server-Timing` and `x-request-id` headers.
|
|
135
|
+
|
|
136
|
+
## Credits
|
|
137
|
+
|
|
138
|
+
One Firecrawl credit is one `vision.page`; a PDF uses one per page read. `team/credit-usage` reports your organization's monthly page allowance (`vision.pages.monthly`, 100,000 pages to start) as the plan's credits and the pages billed this month as used; with no allowance set (unlimited) both credit fields are `0`, which limits nothing, never `null`, since firecrawl-py requires a number. With an allowance, once `remainingCredits` reaches 0, scrapes answer `429` (`quota_exceeded`) until the next UTC month. A failed scrape uses no credit. A wall (a refusal or challenge page with little content) costs no credit (`creditsUsed` 0) and carries no page content: its document has `markdown: ""` and `metadata` with `sourceURL`, `url`, `statusCode`, `pageState`, `contentWithheld: true`, `contentWithheldReason` and `contentWithheldOptIn`. The B3OS option `walls: "bill"` returns a wall's content for one credit. Billing, limits and the cache work as for native [scrapes](https://docs.beta.b3os.org/vision/scrape), and a scrape with a profile takes a browser of its own that counts toward `vision.sessions.concurrent`. The beta is free; see [pricing](https://docs.beta.b3os.org/concepts/usage#pricing).
|