@b3os/sdk 0.0.0-stage → 0.1.0
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/LICENSE +202 -0
- package/README.md +233 -2
- package/dist/cjs/core/client.d.ts +165 -0
- package/dist/cjs/core/client.js +825 -0
- package/dist/cjs/core/client.js.map +1 -0
- package/dist/cjs/core/errors.d.ts +101 -0
- package/dist/cjs/core/errors.js +249 -0
- package/dist/cjs/core/errors.js.map +1 -0
- package/dist/cjs/core/index.d.ts +12 -0
- package/dist/cjs/core/index.js +42 -0
- package/dist/cjs/core/index.js.map +1 -0
- package/dist/cjs/core/jobs.d.ts +31 -0
- package/dist/cjs/core/jobs.js +72 -0
- package/dist/cjs/core/jobs.js.map +1 -0
- package/dist/cjs/core/namespace.d.ts +7 -0
- package/dist/cjs/core/namespace.js +13 -0
- package/dist/cjs/core/namespace.js.map +1 -0
- package/dist/cjs/core/op.d.ts +47 -0
- package/dist/cjs/core/op.js +5 -0
- package/dist/cjs/core/op.js.map +1 -0
- package/dist/cjs/core/promise.d.ts +106 -0
- package/dist/cjs/core/promise.js +200 -0
- package/dist/cjs/core/promise.js.map +1 -0
- package/dist/cjs/core/response.d.ts +54 -0
- package/dist/cjs/core/response.js +92 -0
- package/dist/cjs/core/response.js.map +1 -0
- package/dist/cjs/core/sse.d.ts +79 -0
- package/dist/cjs/core/sse.js +291 -0
- package/dist/cjs/core/sse.js.map +1 -0
- package/dist/cjs/core/timing.d.ts +20 -0
- package/dist/cjs/core/timing.js +96 -0
- package/dist/cjs/core/timing.js.map +1 -0
- package/dist/cjs/core/transport.d.ts +80 -0
- package/dist/cjs/core/transport.js +472 -0
- package/dist/cjs/core/transport.js.map +1 -0
- package/dist/cjs/core/util.d.ts +25 -0
- package/dist/cjs/core/util.js +142 -0
- package/dist/cjs/core/util.js.map +1 -0
- package/dist/cjs/core/ws.d.ts +52 -0
- package/dist/cjs/core/ws.js +181 -0
- package/dist/cjs/core/ws.js.map +1 -0
- package/dist/cjs/generated/client.d.ts +62 -0
- package/dist/cjs/generated/client.js +130 -0
- package/dist/cjs/generated/client.js.map +1 -0
- package/dist/cjs/generated/errors.d.ts +4 -0
- package/dist/cjs/generated/errors.js +160 -0
- package/dist/cjs/generated/errors.js.map +1 -0
- package/dist/cjs/generated/ids.d.ts +114 -0
- package/dist/cjs/generated/ids.js +47 -0
- package/dist/cjs/generated/ids.js.map +1 -0
- package/dist/cjs/generated/jobs.d.ts +10 -0
- package/dist/cjs/generated/jobs.js +24 -0
- package/dist/cjs/generated/jobs.js.map +1 -0
- package/dist/cjs/generated/ns/actions.d.ts +161 -0
- package/dist/cjs/generated/ns/actions.js +304 -0
- package/dist/cjs/generated/ns/actions.js.map +1 -0
- package/dist/cjs/generated/ns/infer.d.ts +190 -0
- package/dist/cjs/generated/ns/infer.js +253 -0
- package/dist/cjs/generated/ns/infer.js.map +1 -0
- package/dist/cjs/generated/ns/keys.d.ts +76 -0
- package/dist/cjs/generated/ns/keys.js +144 -0
- package/dist/cjs/generated/ns/keys.js.map +1 -0
- package/dist/cjs/generated/ns/limits.d.ts +22 -0
- package/dist/cjs/generated/ns/limits.js +32 -0
- package/dist/cjs/generated/ns/limits.js.map +1 -0
- package/dist/cjs/generated/ns/orgs.d.ts +38 -0
- package/dist/cjs/generated/ns/orgs.js +68 -0
- package/dist/cjs/generated/ns/orgs.js.map +1 -0
- package/dist/cjs/generated/ns/projects.d.ts +57 -0
- package/dist/cjs/generated/ns/projects.js +115 -0
- package/dist/cjs/generated/ns/projects.js.map +1 -0
- package/dist/cjs/generated/ns/render.d.ts +159 -0
- package/dist/cjs/generated/ns/render.js +299 -0
- package/dist/cjs/generated/ns/render.js.map +1 -0
- package/dist/cjs/generated/ns/requests.d.ts +36 -0
- package/dist/cjs/generated/ns/requests.js +54 -0
- package/dist/cjs/generated/ns/requests.js.map +1 -0
- package/dist/cjs/generated/ns/routines.d.ts +212 -0
- package/dist/cjs/generated/ns/routines.js +419 -0
- package/dist/cjs/generated/ns/routines.js.map +1 -0
- package/dist/cjs/generated/ns/sandboxes.d.ts +318 -0
- package/dist/cjs/generated/ns/sandboxes.js +549 -0
- package/dist/cjs/generated/ns/sandboxes.js.map +1 -0
- package/dist/cjs/generated/ns/usage.d.ts +30 -0
- package/dist/cjs/generated/ns/usage.js +49 -0
- package/dist/cjs/generated/ns/usage.js.map +1 -0
- package/dist/cjs/generated/ns/vault.d.ts +69 -0
- package/dist/cjs/generated/ns/vault.js +122 -0
- package/dist/cjs/generated/ns/vault.js.map +1 -0
- package/dist/cjs/generated/ns/vision.d.ts +376 -0
- package/dist/cjs/generated/ns/vision.js +736 -0
- package/dist/cjs/generated/ns/vision.js.map +1 -0
- package/dist/cjs/generated/ns/webhooks.d.ts +50 -0
- package/dist/cjs/generated/ns/webhooks.js +91 -0
- package/dist/cjs/generated/ns/webhooks.js.map +1 -0
- package/dist/cjs/generated/types.d.ts +4613 -0
- package/dist/cjs/generated/types.js +4 -0
- package/dist/cjs/generated/types.js.map +1 -0
- package/dist/cjs/index.d.ts +22 -0
- package/dist/cjs/index.js +81 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/webhooks.d.ts +19 -0
- package/dist/cjs/webhooks.js +85 -0
- package/dist/cjs/webhooks.js.map +1 -0
- package/dist/esm/core/client.d.ts +165 -0
- package/dist/esm/core/client.js +821 -0
- package/dist/esm/core/client.js.map +1 -0
- package/dist/esm/core/errors.d.ts +101 -0
- package/dist/esm/core/errors.js +239 -0
- package/dist/esm/core/errors.js.map +1 -0
- package/dist/esm/core/index.d.ts +12 -0
- package/dist/esm/core/index.js +15 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/core/jobs.d.ts +31 -0
- package/dist/esm/core/jobs.js +66 -0
- package/dist/esm/core/jobs.js.map +1 -0
- package/dist/esm/core/namespace.d.ts +7 -0
- package/dist/esm/core/namespace.js +9 -0
- package/dist/esm/core/namespace.js.map +1 -0
- package/dist/esm/core/op.d.ts +47 -0
- package/dist/esm/core/op.js +4 -0
- package/dist/esm/core/op.js.map +1 -0
- package/dist/esm/core/promise.d.ts +106 -0
- package/dist/esm/core/promise.js +193 -0
- package/dist/esm/core/promise.js.map +1 -0
- package/dist/esm/core/response.d.ts +54 -0
- package/dist/esm/core/response.js +86 -0
- package/dist/esm/core/response.js.map +1 -0
- package/dist/esm/core/sse.d.ts +79 -0
- package/dist/esm/core/sse.js +286 -0
- package/dist/esm/core/sse.js.map +1 -0
- package/dist/esm/core/timing.d.ts +20 -0
- package/dist/esm/core/timing.js +92 -0
- package/dist/esm/core/timing.js.map +1 -0
- package/dist/esm/core/transport.d.ts +80 -0
- package/dist/esm/core/transport.js +465 -0
- package/dist/esm/core/transport.js.map +1 -0
- package/dist/esm/core/util.d.ts +25 -0
- package/dist/esm/core/util.js +128 -0
- package/dist/esm/core/util.js.map +1 -0
- package/dist/esm/core/ws.d.ts +52 -0
- package/dist/esm/core/ws.js +175 -0
- package/dist/esm/core/ws.js.map +1 -0
- package/dist/esm/generated/client.d.ts +62 -0
- package/dist/esm/generated/client.js +126 -0
- package/dist/esm/generated/client.js.map +1 -0
- package/dist/esm/generated/errors.d.ts +4 -0
- package/dist/esm/generated/errors.js +157 -0
- package/dist/esm/generated/errors.js.map +1 -0
- package/dist/esm/generated/ids.d.ts +114 -0
- package/dist/esm/generated/ids.js +42 -0
- package/dist/esm/generated/ids.js.map +1 -0
- package/dist/esm/generated/jobs.d.ts +10 -0
- package/dist/esm/generated/jobs.js +21 -0
- package/dist/esm/generated/jobs.js.map +1 -0
- package/dist/esm/generated/ns/actions.d.ts +161 -0
- package/dist/esm/generated/ns/actions.js +300 -0
- package/dist/esm/generated/ns/actions.js.map +1 -0
- package/dist/esm/generated/ns/infer.d.ts +190 -0
- package/dist/esm/generated/ns/infer.js +249 -0
- package/dist/esm/generated/ns/infer.js.map +1 -0
- package/dist/esm/generated/ns/keys.d.ts +76 -0
- package/dist/esm/generated/ns/keys.js +140 -0
- package/dist/esm/generated/ns/keys.js.map +1 -0
- package/dist/esm/generated/ns/limits.d.ts +22 -0
- package/dist/esm/generated/ns/limits.js +28 -0
- package/dist/esm/generated/ns/limits.js.map +1 -0
- package/dist/esm/generated/ns/orgs.d.ts +38 -0
- package/dist/esm/generated/ns/orgs.js +64 -0
- package/dist/esm/generated/ns/orgs.js.map +1 -0
- package/dist/esm/generated/ns/projects.d.ts +57 -0
- package/dist/esm/generated/ns/projects.js +111 -0
- package/dist/esm/generated/ns/projects.js.map +1 -0
- package/dist/esm/generated/ns/render.d.ts +159 -0
- package/dist/esm/generated/ns/render.js +295 -0
- package/dist/esm/generated/ns/render.js.map +1 -0
- package/dist/esm/generated/ns/requests.d.ts +36 -0
- package/dist/esm/generated/ns/requests.js +50 -0
- package/dist/esm/generated/ns/requests.js.map +1 -0
- package/dist/esm/generated/ns/routines.d.ts +212 -0
- package/dist/esm/generated/ns/routines.js +415 -0
- package/dist/esm/generated/ns/routines.js.map +1 -0
- package/dist/esm/generated/ns/sandboxes.d.ts +318 -0
- package/dist/esm/generated/ns/sandboxes.js +545 -0
- package/dist/esm/generated/ns/sandboxes.js.map +1 -0
- package/dist/esm/generated/ns/usage.d.ts +30 -0
- package/dist/esm/generated/ns/usage.js +45 -0
- package/dist/esm/generated/ns/usage.js.map +1 -0
- package/dist/esm/generated/ns/vault.d.ts +69 -0
- package/dist/esm/generated/ns/vault.js +118 -0
- package/dist/esm/generated/ns/vault.js.map +1 -0
- package/dist/esm/generated/ns/vision.d.ts +376 -0
- package/dist/esm/generated/ns/vision.js +732 -0
- package/dist/esm/generated/ns/vision.js.map +1 -0
- package/dist/esm/generated/ns/webhooks.d.ts +50 -0
- package/dist/esm/generated/ns/webhooks.js +87 -0
- package/dist/esm/generated/ns/webhooks.js.map +1 -0
- package/dist/esm/generated/types.d.ts +4613 -0
- package/dist/esm/generated/types.js +3 -0
- package/dist/esm/generated/types.js.map +1 -0
- package/dist/esm/index.d.ts +22 -0
- package/dist/esm/index.js +28 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/webhooks.d.ts +19 -0
- package/dist/esm/webhooks.js +79 -0
- package/dist/esm/webhooks.js.map +1 -0
- package/package.json +97 -3
- package/src/core/client.ts +1022 -0
- package/src/core/errors.ts +296 -0
- package/src/core/index.ts +45 -0
- package/src/core/jobs.ts +94 -0
- package/src/core/namespace.ts +10 -0
- package/src/core/op.ts +53 -0
- package/src/core/promise.ts +268 -0
- package/src/core/response.ts +115 -0
- package/src/core/sse.ts +305 -0
- package/src/core/timing.ts +106 -0
- package/src/core/transport.ts +489 -0
- package/src/core/util.ts +138 -0
- package/src/core/ws.ts +215 -0
- package/src/generated/client.ts +143 -0
- package/src/generated/errors.ts +313 -0
- package/src/generated/ids.ts +47 -0
- package/src/generated/jobs.ts +25 -0
- package/src/generated/ns/actions.ts +353 -0
- package/src/generated/ns/infer.ts +332 -0
- package/src/generated/ns/keys.ts +152 -0
- package/src/generated/ns/limits.ts +35 -0
- package/src/generated/ns/orgs.ts +77 -0
- package/src/generated/ns/projects.ts +122 -0
- package/src/generated/ns/render.ts +348 -0
- package/src/generated/ns/requests.ts +61 -0
- package/src/generated/ns/routines.ts +474 -0
- package/src/generated/ns/sandboxes.ts +671 -0
- package/src/generated/ns/usage.ts +56 -0
- package/src/generated/ns/vault.ts +136 -0
- package/src/generated/ns/vision.ts +836 -0
- package/src/generated/ns/webhooks.ts +100 -0
- package/src/generated/types.ts +5131 -0
- package/src/index.ts +30 -0
- package/src/webhooks.ts +100 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../src/generated/ns/actions.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAG5G,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAKpD,MAAM,MAAM,GAAO;IACjB,EAAE,EAAE,aAAa;IACjB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,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B,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,EACpC,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,YAAY,CAAC,SAAiB,EAAE,IAAY,EAAE,OAAe,EAAE,OAAwB;QACrF,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CACvB,cAAc,EACd,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,EACpC,OAAO,EACP,4CAA4C,EAC5C,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,MAA6B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAuB,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;;;;OASG;IACH,iBAAiB,CACf,MAAyC,EACzC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CACvB,mBAAmB,EACnB,EAAE,KAAK,EAAE,MAAM,EAAE,EACjB,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,eAAe,CAAC,cAAsB,EAAE,OAAwB;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAwB,iBAAiB,EAAE,EAAE,IAAI,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CACV,MAAoC,EACpC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAkC,cAAc,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;CACF"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { RequestOptions, StreamOptions } from "../../core/client.ts";
|
|
2
|
+
import { Namespace } from "../../core/namespace.ts";
|
|
3
|
+
import type { Op } from "../../core/op.ts";
|
|
4
|
+
import type { APIPromise } from "../../core/promise.ts";
|
|
5
|
+
import type { EventStream } from "../../core/sse.ts";
|
|
6
|
+
import type * as T from "../types.ts";
|
|
7
|
+
/** Descriptors of every infer operation, keyed by method name (for tooling and custom clients). */
|
|
8
|
+
export declare const inferOps: {
|
|
9
|
+
readonly createSpeech: Op;
|
|
10
|
+
readonly listVoices: Op;
|
|
11
|
+
readonly createChatCompletion: Op;
|
|
12
|
+
readonly createEmbeddings: Op;
|
|
13
|
+
readonly listModels: Op;
|
|
14
|
+
readonly getModel: Op;
|
|
15
|
+
readonly createResponse: Op;
|
|
16
|
+
readonly createMessage: Op;
|
|
17
|
+
readonly countMessageTokens: Op;
|
|
18
|
+
};
|
|
19
|
+
/** Models on the node: OpenAI-compatible chat, embeddings and speech (`/v1/infer`). */
|
|
20
|
+
export declare class InferAPI extends Namespace {
|
|
21
|
+
/**
|
|
22
|
+
* Create speech
|
|
23
|
+
*
|
|
24
|
+
* The OpenAI speech API: synthesizes `input` with a voice and returns the audio bytes. B3OS extension:
|
|
25
|
+
* `timestamps: "word"` returns JSON instead, with the audio base64-encoded and the start and end time of every
|
|
26
|
+
* word, which render uses to place clicks on words and cut captions. Every `response_format` is produced:
|
|
27
|
+
* `mp3`, `opus` (Ogg), `aac` (ADTS), `flac`, `wav` and `pcm` (16-bit mono at `sample_rate`, 24 kHz for
|
|
28
|
+
* `kokoro-82m`). `kokoro-82m` speaks at `speed` 0.5 to 2 and takes no `instructions`; other values return
|
|
29
|
+
* `400 unsupported_parameter`. While the node's voice service is down the answer is
|
|
30
|
+
* `503 infer_backend_unavailable` with `Retry-After`. `Server-Timing` carries the voice service's own
|
|
31
|
+
* `voice_queue` and `voice_run` beside b3osd's `synthesize` and `encode`. Bills `infer.audio_chars`
|
|
32
|
+
* (characters of `input`).
|
|
33
|
+
*
|
|
34
|
+
* `POST /v1/infer/audio/speech` · scope `infer:run` · served by the node
|
|
35
|
+
*/
|
|
36
|
+
createSpeech(body: T.SpeechRequest & {
|
|
37
|
+
timestamps: "word";
|
|
38
|
+
}, options?: RequestOptions): APIPromise<T.SpeechWithTimestamps>;
|
|
39
|
+
createSpeech(body: T.SpeechRequest, options?: RequestOptions): APIPromise<Uint8Array>;
|
|
40
|
+
/**
|
|
41
|
+
* List voices
|
|
42
|
+
*
|
|
43
|
+
* Lists the voices each speech model offers, with language and an audio sample. A B3OS endpoint (not part of
|
|
44
|
+
* the OpenAI API), so it uses B3OS lists and errors: `503 infer_backend_unavailable` with `Retry-After` while
|
|
45
|
+
* the voice service is down. All voices arrive in one page (`next_cursor` is always `null`).
|
|
46
|
+
*
|
|
47
|
+
* `GET /v1/infer/audio/voices` · scope `infer:read` · served by the node
|
|
48
|
+
*/
|
|
49
|
+
listVoices(params?: T.InferListVoicesParams, options?: RequestOptions): APIPromise<T.VoiceList>;
|
|
50
|
+
/**
|
|
51
|
+
* Create a chat completion
|
|
52
|
+
*
|
|
53
|
+
* The OpenAI Chat Completions API: messages (text and, on models with `image_input`, images), tools and
|
|
54
|
+
* tool choice, `response_format` with JSON Schema, sampling parameters and streaming. With `stream: true` the
|
|
55
|
+
* response is server-sent events of `chat.completion.chunk` objects ending with `data: [DONE]`, exactly as
|
|
56
|
+
* OpenAI sends them; `stream_options.include_usage` adds a final usage chunk (and `"usage": null` on the
|
|
57
|
+
* others). A stream that fails after it started ends with an OpenAI error event
|
|
58
|
+
* (`data: {"error": {...}}`); one that fails before the first token is a plain HTTP error. The response head
|
|
59
|
+
* of a stream waits for the first generated token, so `Server-Timing` can carry `ttft`.
|
|
60
|
+
*
|
|
61
|
+
* Parameters this node does not take return `400 unsupported_parameter` naming the parameter. Besides the
|
|
62
|
+
* OpenAI parameters below, it takes the sampling extensions `top_k`, `min_p`, `repetition_penalty` and
|
|
63
|
+
* `logit_bias`, and `chat_template_kwargs.enable_thinking` (the model answers without a reasoning phase
|
|
64
|
+
* unless it is `true`; the reasoning then arrives in `reasoning_content`). `metadata`, `store` and
|
|
65
|
+
* `service_tier` are accepted and ignored. `null` means unset for every optional parameter. Image URLs are
|
|
66
|
+
* `https://` (fetched by the node through its egress guard, which refuses private, loopback and metadata
|
|
67
|
+
* addresses with `403 egress_denied`) or `data:image/{png,jpeg,webp,gif};base64,`. JSON Schemas (tool
|
|
68
|
+
* `parameters`, `response_format.json_schema.schema`) larger than 64 KiB or nested deeper than 32 levels are
|
|
69
|
+
* `400 unsupported_parameter`.
|
|
70
|
+
*
|
|
71
|
+
* Bills input and output tokens. Requests are admitted against your organization's per-minute limits on the
|
|
72
|
+
* model: one request, and the estimated prompt plus `max_completion_tokens` (or `max_tokens`, else 512
|
|
73
|
+
* tokens), settled with the real counts when the request ends.
|
|
74
|
+
*
|
|
75
|
+
* `POST /v1/infer/chat/completions` · scope `infer:run` · served by the node
|
|
76
|
+
*/
|
|
77
|
+
createChatCompletion(body: T.ChatCompletionRequest & {
|
|
78
|
+
stream: true;
|
|
79
|
+
}, options?: StreamOptions): EventStream<T.ChatCompletionChunk>;
|
|
80
|
+
createChatCompletion(body: T.ChatCompletionRequest & {
|
|
81
|
+
stream?: false | null;
|
|
82
|
+
}, options?: RequestOptions): APIPromise<T.ChatCompletion>;
|
|
83
|
+
/**
|
|
84
|
+
* Create embeddings
|
|
85
|
+
*
|
|
86
|
+
* The OpenAI Embeddings API, for embedding models the node serves (`b3os.kind` is `embedding`). Other models
|
|
87
|
+
* return `404 model_not_available`; the beta node serves no embedding model yet. Bills input tokens.
|
|
88
|
+
*
|
|
89
|
+
* `POST /v1/infer/embeddings` · scope `infer:run` · served by the node
|
|
90
|
+
*
|
|
91
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
92
|
+
*/
|
|
93
|
+
createEmbeddings(body: T.EmbeddingRequest, options?: RequestOptions): APIPromise<T.EmbeddingList>;
|
|
94
|
+
/**
|
|
95
|
+
* List models
|
|
96
|
+
*
|
|
97
|
+
* The OpenAI model list for the models this node serves, each with a `b3os` object: context length,
|
|
98
|
+
* quantization, whether it supports tools, JSON Schema output and image input, the largest accepted request,
|
|
99
|
+
* and your per-model token and request limits. Chat models are listed while the node's model runtime is
|
|
100
|
+
* configured (one that is restarting is still listed; requests get `503` with `Retry-After`); speech models
|
|
101
|
+
* while the voice service answers.
|
|
102
|
+
*
|
|
103
|
+
* `GET /v1/infer/models` · scope `infer:read` · served by the node
|
|
104
|
+
*/
|
|
105
|
+
listModels(options?: RequestOptions): APIPromise<T.ModelList>;
|
|
106
|
+
/**
|
|
107
|
+
* Get a model
|
|
108
|
+
*
|
|
109
|
+
* One model from the list, by ID. IDs may contain a slash (`b3os/qwen3.5-9b`); send it unencoded.
|
|
110
|
+
*
|
|
111
|
+
* `GET /v1/infer/models/{model}` · scope `infer:read` · served by the node
|
|
112
|
+
*/
|
|
113
|
+
getModel(model: string, options?: RequestOptions): APIPromise<T.Model>;
|
|
114
|
+
/**
|
|
115
|
+
* Create a response (OpenAI Responses API)
|
|
116
|
+
*
|
|
117
|
+
* A stateless subset of the OpenAI Responses API on the node's own models, for SDKs and agent frameworks that
|
|
118
|
+
* speak Responses (the OpenAI Agents SDK among them) with only the base URL changed: `input` as a string or
|
|
119
|
+
* as items (`message` with `input_text` and `input_image` parts, or `output_text` for assistant turns;
|
|
120
|
+
* `function_call`, `function_call_output` and `reasoning` items), `instructions`, function tools with
|
|
121
|
+
* `tool_choice` and `parallel_tool_calls`, structured output through `text.format` (`json_schema`,
|
|
122
|
+
* `json_object`), `reasoning.effort` (`low` and above turn the model's reasoning phase on; its text arrives
|
|
123
|
+
* in `reasoning` items), `max_output_tokens`, `temperature`, `top_p`, and the Responses event stream
|
|
124
|
+
* (`response.created` ... `response.completed`, as OpenAI sends them).
|
|
125
|
+
*
|
|
126
|
+
* Nothing is stored: send the whole conversation as `input` items each turn. `previous_response_id`,
|
|
127
|
+
* `conversation`, `prompt`, `background: true` and `truncation: "auto"` are `400 unsupported_parameter`;
|
|
128
|
+
* `store`, `metadata` (echoed), `user`, `safety_identifier`, `prompt_cache_key`, `service_tier`,
|
|
129
|
+
* `text.verbosity`, `reasoning.summary` and `include: ["reasoning.encrypted_content"]` are accepted and
|
|
130
|
+
* ignored, and every response reports `store: false`. Tools other than `function` (web search, file
|
|
131
|
+
* search, computer use, code interpreter, MCP, image generation, shell) run on OpenAI's side and are
|
|
132
|
+
* `400 unsupported_parameter`. `null` means unset for every optional parameter. Images and JSON Schemas
|
|
133
|
+
* have the limits of chat completions. A stream that fails after it started ends with an `error` event; one
|
|
134
|
+
* that fails before the first token is a plain HTTP error. The response head of a stream waits for the
|
|
135
|
+
* first generated token, so `Server-Timing` can carry `ttft`.
|
|
136
|
+
*
|
|
137
|
+
* Bills input and output tokens, with the admission and limits of chat completions (the estimated prompt
|
|
138
|
+
* plus `max_output_tokens`, else 512 tokens, settled with the real counts; an abandoned stream is billed to
|
|
139
|
+
* its last token).
|
|
140
|
+
*
|
|
141
|
+
* `POST /v1/infer/responses` · scope `infer:run` · served by the node
|
|
142
|
+
*
|
|
143
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
144
|
+
*/
|
|
145
|
+
createResponse(body: T.ResponsesRequest, options?: RequestOptions): APIPromise<T.ResponsesResponse>;
|
|
146
|
+
/**
|
|
147
|
+
* Create a message (Anthropic Messages API)
|
|
148
|
+
*
|
|
149
|
+
* The Anthropic Messages API on the node's own model, so Anthropic SDKs and agents built on them run against
|
|
150
|
+
* it with only the base URL and the credential changed: set `ANTHROPIC_BASE_URL` (or `base_url`) to
|
|
151
|
+
* `https://beta-api.b3os.org/v1/infer`, the same base URL as the OpenAI SDKs (`http://127.0.0.1:7700/v1/infer`
|
|
152
|
+
* inside a sandbox; the SDKs add `/v1/messages`), and send the B3OS key as a bearer token
|
|
153
|
+
* (`ANTHROPIC_AUTH_TOKEN`, or `auth_token` in the SDKs). Text, images (`base64`, or `url` sources fetched by
|
|
154
|
+
* the node through its egress guard), custom tools with `tool_use` and `tool_result` blocks, `tool_choice`,
|
|
155
|
+
* `thinking` (the reasoning arrives in `thinking` blocks; `budget_tokens` caps it), JSON Schema output
|
|
156
|
+
* through `output_config.format`, stop sequences, a trailing assistant turn that the model continues, and
|
|
157
|
+
* streaming events (`message_start` ... `message_stop`, exactly as Anthropic sends them). Models are those
|
|
158
|
+
* of `GET /v1/infer/models`; there is no gateway route here.
|
|
159
|
+
*
|
|
160
|
+
* Parameters this node does not take return `400 unsupported_parameter` (tools Anthropic defines or runs,
|
|
161
|
+
* such as `web_search` or `bash`, `container`, `mcp_servers`, document and file sources).
|
|
162
|
+
* `cache_control`, `citations`, `metadata`, `service_tier`, `output_config.effort` and `thinking.display`
|
|
163
|
+
* are accepted and ignored (the runtime caches prompt prefixes on its own). Errors use the Anthropic shape
|
|
164
|
+
* (`{"type": "error", "error": {...}}`, with the B3OS code under `b3os`), except those raised before the
|
|
165
|
+
* request reaches the infer service (authentication, scopes, body size), which use the OpenAI shape of the
|
|
166
|
+
* rest of `/v1/infer`; Anthropic SDKs map both by HTTP status. A stream that fails after it started ends
|
|
167
|
+
* with an `error` event; one that fails before the first token is a plain HTTP error. The response head of
|
|
168
|
+
* a stream waits for the first generated token, so `Server-Timing` can carry `ttft`.
|
|
169
|
+
*
|
|
170
|
+
* Bills input and output tokens, with the admission and limits of chat completions (the estimated prompt
|
|
171
|
+
* plus `max_tokens`, settled with the real counts; an abandoned stream is billed to its last token).
|
|
172
|
+
*
|
|
173
|
+
* `POST /v1/infer/v1/messages` · scope `infer:run` · served by the node
|
|
174
|
+
*
|
|
175
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
176
|
+
*/
|
|
177
|
+
createMessage(body: T.AnthropicMessagesRequest, options?: RequestOptions): APIPromise<T.AnthropicMessage>;
|
|
178
|
+
/**
|
|
179
|
+
* Count the tokens of a message request
|
|
180
|
+
*
|
|
181
|
+
* The Anthropic token-counting API: the input tokens a Messages request with the same `messages`, `system`,
|
|
182
|
+
* `tools`, `tool_choice` and `thinking` would use, counted by the model runtime with the model's own chat
|
|
183
|
+
* template (images included). Free: it counts against your requests per minute, not your tokens.
|
|
184
|
+
*
|
|
185
|
+
* `POST /v1/infer/v1/messages/count_tokens` · scope `infer:run` · served by the node
|
|
186
|
+
*
|
|
187
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
188
|
+
*/
|
|
189
|
+
countMessageTokens(body: T.AnthropicCountTokensRequest, options?: RequestOptions): APIPromise<T.AnthropicCountTokens>;
|
|
190
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
// Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
|
|
2
|
+
import { Namespace } from "../../core/namespace.js";
|
|
3
|
+
const createSpeechOp = {
|
|
4
|
+
id: "inferCreateSpeech",
|
|
5
|
+
method: "POST",
|
|
6
|
+
path: "/v1/infer/audio/speech",
|
|
7
|
+
body: "json",
|
|
8
|
+
timeoutMs: 65000,
|
|
9
|
+
errorFormat: "openai",
|
|
10
|
+
scope: "infer:run",
|
|
11
|
+
};
|
|
12
|
+
const listVoicesOp = {
|
|
13
|
+
id: "inferListVoices",
|
|
14
|
+
method: "GET",
|
|
15
|
+
path: "/v1/infer/audio/voices",
|
|
16
|
+
timeoutMs: 10000,
|
|
17
|
+
scope: "infer:read",
|
|
18
|
+
};
|
|
19
|
+
const createChatCompletionOp = {
|
|
20
|
+
id: "inferCreateChatCompletion",
|
|
21
|
+
method: "POST",
|
|
22
|
+
path: "/v1/infer/chat/completions",
|
|
23
|
+
body: "json",
|
|
24
|
+
stream: "sse",
|
|
25
|
+
timeoutMs: 600000,
|
|
26
|
+
errorFormat: "openai",
|
|
27
|
+
scope: "infer:run",
|
|
28
|
+
};
|
|
29
|
+
const createEmbeddingsOp = {
|
|
30
|
+
id: "inferCreateEmbeddings",
|
|
31
|
+
method: "POST",
|
|
32
|
+
path: "/v1/infer/embeddings",
|
|
33
|
+
body: "json",
|
|
34
|
+
timeoutMs: 65000,
|
|
35
|
+
errorFormat: "openai",
|
|
36
|
+
stretch: true,
|
|
37
|
+
scope: "infer:run",
|
|
38
|
+
};
|
|
39
|
+
const listModelsOp = {
|
|
40
|
+
id: "inferListModels",
|
|
41
|
+
method: "GET",
|
|
42
|
+
path: "/v1/infer/models",
|
|
43
|
+
timeoutMs: 10000,
|
|
44
|
+
errorFormat: "openai",
|
|
45
|
+
scope: "infer:read",
|
|
46
|
+
};
|
|
47
|
+
const getModelOp = {
|
|
48
|
+
id: "inferGetModel",
|
|
49
|
+
method: "GET",
|
|
50
|
+
path: "/v1/infer/models/{model}",
|
|
51
|
+
params: ["model"],
|
|
52
|
+
wildcard: "model",
|
|
53
|
+
timeoutMs: 10000,
|
|
54
|
+
errorFormat: "openai",
|
|
55
|
+
scope: "infer:read",
|
|
56
|
+
};
|
|
57
|
+
const createResponseOp = {
|
|
58
|
+
id: "inferCreateResponse",
|
|
59
|
+
method: "POST",
|
|
60
|
+
path: "/v1/infer/responses",
|
|
61
|
+
body: "json",
|
|
62
|
+
stream: "sse",
|
|
63
|
+
timeoutMs: 600000,
|
|
64
|
+
errorFormat: "openai",
|
|
65
|
+
stretch: true,
|
|
66
|
+
scope: "infer:run",
|
|
67
|
+
};
|
|
68
|
+
const createMessageOp = {
|
|
69
|
+
id: "inferCreateMessage",
|
|
70
|
+
method: "POST",
|
|
71
|
+
path: "/v1/infer/v1/messages",
|
|
72
|
+
body: "json",
|
|
73
|
+
stream: "sse",
|
|
74
|
+
timeoutMs: 600000,
|
|
75
|
+
errorFormat: "openai",
|
|
76
|
+
stretch: true,
|
|
77
|
+
scope: "infer:run",
|
|
78
|
+
};
|
|
79
|
+
const countMessageTokensOp = {
|
|
80
|
+
id: "inferCountMessageTokens",
|
|
81
|
+
method: "POST",
|
|
82
|
+
path: "/v1/infer/v1/messages/count_tokens",
|
|
83
|
+
body: "json",
|
|
84
|
+
timeoutMs: 30000,
|
|
85
|
+
errorFormat: "openai",
|
|
86
|
+
stretch: true,
|
|
87
|
+
scope: "infer:run",
|
|
88
|
+
};
|
|
89
|
+
/** Descriptors of every infer operation, keyed by method name (for tooling and custom clients). */
|
|
90
|
+
export const inferOps = {
|
|
91
|
+
createSpeech: createSpeechOp,
|
|
92
|
+
listVoices: listVoicesOp,
|
|
93
|
+
createChatCompletion: createChatCompletionOp,
|
|
94
|
+
createEmbeddings: createEmbeddingsOp,
|
|
95
|
+
listModels: listModelsOp,
|
|
96
|
+
getModel: getModelOp,
|
|
97
|
+
createResponse: createResponseOp,
|
|
98
|
+
createMessage: createMessageOp,
|
|
99
|
+
countMessageTokens: countMessageTokensOp,
|
|
100
|
+
};
|
|
101
|
+
/** Models on the node: OpenAI-compatible chat, embeddings and speech (`/v1/infer`). */
|
|
102
|
+
export class InferAPI extends Namespace {
|
|
103
|
+
createSpeech(body, options = {}) {
|
|
104
|
+
if (body.timestamps === "word") {
|
|
105
|
+
return this._client._call(createSpeechOp, { body }, options);
|
|
106
|
+
}
|
|
107
|
+
return this._client._call(createSpeechOp, { body }, options, "audio/mpeg, audio/wav, audio/pcm, audio/ogg, audio/aac, audio/flac", "bytes");
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* List voices
|
|
111
|
+
*
|
|
112
|
+
* Lists the voices each speech model offers, with language and an audio sample. A B3OS endpoint (not part of
|
|
113
|
+
* the OpenAI API), so it uses B3OS lists and errors: `503 infer_backend_unavailable` with `Retry-After` while
|
|
114
|
+
* the voice service is down. All voices arrive in one page (`next_cursor` is always `null`).
|
|
115
|
+
*
|
|
116
|
+
* `GET /v1/infer/audio/voices` · scope `infer:read` · served by the node
|
|
117
|
+
*/
|
|
118
|
+
listVoices(params, options) {
|
|
119
|
+
return this._client._call(listVoicesOp, { query: params }, options);
|
|
120
|
+
}
|
|
121
|
+
createChatCompletion(body, options = {}) {
|
|
122
|
+
if (body.stream) {
|
|
123
|
+
return this._client._postStream(createChatCompletionOp, { body }, options, {
|
|
124
|
+
doneSentinel: true,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return this._client._call(createChatCompletionOp, { body }, options);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create embeddings
|
|
131
|
+
*
|
|
132
|
+
* The OpenAI Embeddings API, for embedding models the node serves (`b3os.kind` is `embedding`). Other models
|
|
133
|
+
* return `404 model_not_available`; the beta node serves no embedding model yet. Bills input tokens.
|
|
134
|
+
*
|
|
135
|
+
* `POST /v1/infer/embeddings` · scope `infer:run` · served by the node
|
|
136
|
+
*
|
|
137
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
138
|
+
*/
|
|
139
|
+
createEmbeddings(body, options) {
|
|
140
|
+
return this._client._call(createEmbeddingsOp, { body }, options);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* List models
|
|
144
|
+
*
|
|
145
|
+
* The OpenAI model list for the models this node serves, each with a `b3os` object: context length,
|
|
146
|
+
* quantization, whether it supports tools, JSON Schema output and image input, the largest accepted request,
|
|
147
|
+
* and your per-model token and request limits. Chat models are listed while the node's model runtime is
|
|
148
|
+
* configured (one that is restarting is still listed; requests get `503` with `Retry-After`); speech models
|
|
149
|
+
* while the voice service answers.
|
|
150
|
+
*
|
|
151
|
+
* `GET /v1/infer/models` · scope `infer:read` · served by the node
|
|
152
|
+
*/
|
|
153
|
+
listModels(options) {
|
|
154
|
+
return this._client._call(listModelsOp, {}, options);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get a model
|
|
158
|
+
*
|
|
159
|
+
* One model from the list, by ID. IDs may contain a slash (`b3os/qwen3.5-9b`); send it unencoded.
|
|
160
|
+
*
|
|
161
|
+
* `GET /v1/infer/models/{model}` · scope `infer:read` · served by the node
|
|
162
|
+
*/
|
|
163
|
+
getModel(model, options) {
|
|
164
|
+
return this._client._call(getModelOp, { path: [model] }, options);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Create a response (OpenAI Responses API)
|
|
168
|
+
*
|
|
169
|
+
* A stateless subset of the OpenAI Responses API on the node's own models, for SDKs and agent frameworks that
|
|
170
|
+
* speak Responses (the OpenAI Agents SDK among them) with only the base URL changed: `input` as a string or
|
|
171
|
+
* as items (`message` with `input_text` and `input_image` parts, or `output_text` for assistant turns;
|
|
172
|
+
* `function_call`, `function_call_output` and `reasoning` items), `instructions`, function tools with
|
|
173
|
+
* `tool_choice` and `parallel_tool_calls`, structured output through `text.format` (`json_schema`,
|
|
174
|
+
* `json_object`), `reasoning.effort` (`low` and above turn the model's reasoning phase on; its text arrives
|
|
175
|
+
* in `reasoning` items), `max_output_tokens`, `temperature`, `top_p`, and the Responses event stream
|
|
176
|
+
* (`response.created` ... `response.completed`, as OpenAI sends them).
|
|
177
|
+
*
|
|
178
|
+
* Nothing is stored: send the whole conversation as `input` items each turn. `previous_response_id`,
|
|
179
|
+
* `conversation`, `prompt`, `background: true` and `truncation: "auto"` are `400 unsupported_parameter`;
|
|
180
|
+
* `store`, `metadata` (echoed), `user`, `safety_identifier`, `prompt_cache_key`, `service_tier`,
|
|
181
|
+
* `text.verbosity`, `reasoning.summary` and `include: ["reasoning.encrypted_content"]` are accepted and
|
|
182
|
+
* ignored, and every response reports `store: false`. Tools other than `function` (web search, file
|
|
183
|
+
* search, computer use, code interpreter, MCP, image generation, shell) run on OpenAI's side and are
|
|
184
|
+
* `400 unsupported_parameter`. `null` means unset for every optional parameter. Images and JSON Schemas
|
|
185
|
+
* have the limits of chat completions. A stream that fails after it started ends with an `error` event; one
|
|
186
|
+
* that fails before the first token is a plain HTTP error. The response head of a stream waits for the
|
|
187
|
+
* first generated token, so `Server-Timing` can carry `ttft`.
|
|
188
|
+
*
|
|
189
|
+
* Bills input and output tokens, with the admission and limits of chat completions (the estimated prompt
|
|
190
|
+
* plus `max_output_tokens`, else 512 tokens, settled with the real counts; an abandoned stream is billed to
|
|
191
|
+
* its last token).
|
|
192
|
+
*
|
|
193
|
+
* `POST /v1/infer/responses` · scope `infer:run` · served by the node
|
|
194
|
+
*
|
|
195
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
196
|
+
*/
|
|
197
|
+
createResponse(body, options) {
|
|
198
|
+
return this._client._call(createResponseOp, { body }, options);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Create a message (Anthropic Messages API)
|
|
202
|
+
*
|
|
203
|
+
* The Anthropic Messages API on the node's own model, so Anthropic SDKs and agents built on them run against
|
|
204
|
+
* it with only the base URL and the credential changed: set `ANTHROPIC_BASE_URL` (or `base_url`) to
|
|
205
|
+
* `https://beta-api.b3os.org/v1/infer`, the same base URL as the OpenAI SDKs (`http://127.0.0.1:7700/v1/infer`
|
|
206
|
+
* inside a sandbox; the SDKs add `/v1/messages`), and send the B3OS key as a bearer token
|
|
207
|
+
* (`ANTHROPIC_AUTH_TOKEN`, or `auth_token` in the SDKs). Text, images (`base64`, or `url` sources fetched by
|
|
208
|
+
* the node through its egress guard), custom tools with `tool_use` and `tool_result` blocks, `tool_choice`,
|
|
209
|
+
* `thinking` (the reasoning arrives in `thinking` blocks; `budget_tokens` caps it), JSON Schema output
|
|
210
|
+
* through `output_config.format`, stop sequences, a trailing assistant turn that the model continues, and
|
|
211
|
+
* streaming events (`message_start` ... `message_stop`, exactly as Anthropic sends them). Models are those
|
|
212
|
+
* of `GET /v1/infer/models`; there is no gateway route here.
|
|
213
|
+
*
|
|
214
|
+
* Parameters this node does not take return `400 unsupported_parameter` (tools Anthropic defines or runs,
|
|
215
|
+
* such as `web_search` or `bash`, `container`, `mcp_servers`, document and file sources).
|
|
216
|
+
* `cache_control`, `citations`, `metadata`, `service_tier`, `output_config.effort` and `thinking.display`
|
|
217
|
+
* are accepted and ignored (the runtime caches prompt prefixes on its own). Errors use the Anthropic shape
|
|
218
|
+
* (`{"type": "error", "error": {...}}`, with the B3OS code under `b3os`), except those raised before the
|
|
219
|
+
* request reaches the infer service (authentication, scopes, body size), which use the OpenAI shape of the
|
|
220
|
+
* rest of `/v1/infer`; Anthropic SDKs map both by HTTP status. A stream that fails after it started ends
|
|
221
|
+
* with an `error` event; one that fails before the first token is a plain HTTP error. The response head of
|
|
222
|
+
* a stream waits for the first generated token, so `Server-Timing` can carry `ttft`.
|
|
223
|
+
*
|
|
224
|
+
* Bills input and output tokens, with the admission and limits of chat completions (the estimated prompt
|
|
225
|
+
* plus `max_tokens`, settled with the real counts; an abandoned stream is billed to its last token).
|
|
226
|
+
*
|
|
227
|
+
* `POST /v1/infer/v1/messages` · scope `infer:run` · served by the node
|
|
228
|
+
*
|
|
229
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
230
|
+
*/
|
|
231
|
+
createMessage(body, options) {
|
|
232
|
+
return this._client._call(createMessageOp, { body }, options);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Count the tokens of a message request
|
|
236
|
+
*
|
|
237
|
+
* The Anthropic token-counting API: the input tokens a Messages request with the same `messages`, `system`,
|
|
238
|
+
* `tools`, `tool_choice` and `thinking` would use, counted by the model runtime with the model's own chat
|
|
239
|
+
* template (images included). Free: it counts against your requests per minute, not your tokens.
|
|
240
|
+
*
|
|
241
|
+
* `POST /v1/infer/v1/messages/count_tokens` · scope `infer:run` · served by the node
|
|
242
|
+
*
|
|
243
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
244
|
+
*/
|
|
245
|
+
countMessageTokens(body, options) {
|
|
246
|
+
return this._client._call(countMessageTokensOp, { body }, options);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=infer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infer.js","sourceRoot":"","sources":["../../../../src/generated/ns/infer.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAG5G,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMpD,MAAM,cAAc,GAAO;IACzB,EAAE,EAAE,mBAAmB;IACvB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,wBAAwB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;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,cAAc,CAAC,IAAwB,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAsB,gBAAgB,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,aAAa,CAAC,IAAgC,EAAE,OAAwB;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAqB,eAAe,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;;;;OAUG;IACH,kBAAkB,CAChB,IAAmC,EACnC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAyB,oBAAoB,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7F,CAAC;CACF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { RequestOptions } from "../../core/client.ts";
|
|
2
|
+
import { Namespace } from "../../core/namespace.ts";
|
|
3
|
+
import type { Op } from "../../core/op.ts";
|
|
4
|
+
import type { APIPromise, ListPromise } from "../../core/promise.ts";
|
|
5
|
+
import type * as T from "../types.ts";
|
|
6
|
+
/** Descriptors of every keys operation, keyed by method name (for tooling and custom clients). */
|
|
7
|
+
export declare const keysOps: {
|
|
8
|
+
readonly listKeys: Op;
|
|
9
|
+
readonly createKey: Op;
|
|
10
|
+
readonly getCurrentKey: Op;
|
|
11
|
+
readonly revokeKey: Op;
|
|
12
|
+
readonly getKey: Op;
|
|
13
|
+
readonly updateKey: Op;
|
|
14
|
+
};
|
|
15
|
+
/** API keys (`/v1/keys`; served by beta-api.b3os.org). */
|
|
16
|
+
export declare class KeysAPI extends Namespace {
|
|
17
|
+
/**
|
|
18
|
+
* List API keys
|
|
19
|
+
*
|
|
20
|
+
* Lists the organization's API keys and CLI tokens (secrets are never returned), newest first. `kind` tells
|
|
21
|
+
* them apart; revoke a lost CLI token like any key.
|
|
22
|
+
*
|
|
23
|
+
* `GET /v1/keys` · scope `platform:read` · served by beta-api.b3os.org
|
|
24
|
+
*/
|
|
25
|
+
listKeys(params?: T.PlatformListKeysParams, options?: RequestOptions): ListPromise<T.ApiKeyList, T.ApiKey>;
|
|
26
|
+
/**
|
|
27
|
+
* Create an API key
|
|
28
|
+
*
|
|
29
|
+
* Creates a key in your project (or `project`, in the same organization). `scopes` and `spend_cap_usd` may not
|
|
30
|
+
* exceed the caller's own, and when the caller expires, `expires_at` must be set and no later than the caller's
|
|
31
|
+
* expiry (`forbidden`, reason `scope_escalation`). The response is the only time `secret` is returned.
|
|
32
|
+
*
|
|
33
|
+
* `POST /v1/keys` · scope `platform:write` · served by beta-api.b3os.org
|
|
34
|
+
*/
|
|
35
|
+
createKey(body: T.ApiKeyCreateRequest, options?: RequestOptions): APIPromise<T.ApiKeyWithSecret>;
|
|
36
|
+
/**
|
|
37
|
+
* Describe the calling credential
|
|
38
|
+
*
|
|
39
|
+
* Returns who is calling: the key or CLI token (or dashboard session, or sandbox), its organization and
|
|
40
|
+
* project, scopes, spend cap and expiry. Any valid credential may call it, whatever its scopes.
|
|
41
|
+
*
|
|
42
|
+
* `GET /v1/keys/current` · scope `authenticated` · served by beta-api.b3os.org
|
|
43
|
+
*/
|
|
44
|
+
getCurrentKey(options?: RequestOptions): APIPromise<T.CurrentPrincipal>;
|
|
45
|
+
/**
|
|
46
|
+
* Revoke an API key
|
|
47
|
+
*
|
|
48
|
+
* Revokes the key. The operations the edge answers itself refuse it at once; every other request refuses it
|
|
49
|
+
* within 10 seconds (the edge keeps a key's record at most 10 seconds after reading it from its primary
|
|
50
|
+
* database, and never reads keys from a replica). The edge also pushes the revocation to nodes, so open
|
|
51
|
+
* streams authenticated by it close within 60 seconds. Routines published with it pause their triggers.
|
|
52
|
+
* Returns the revoked key; it stays listed for audit. Changes made with `PATCH /v1/keys/{key_id}` take effect
|
|
53
|
+
* within the same 10 seconds.
|
|
54
|
+
*
|
|
55
|
+
* `DELETE /v1/keys/{key_id}` · scope `platform:write` · served by beta-api.b3os.org
|
|
56
|
+
*/
|
|
57
|
+
revokeKey(keyId: string, options?: RequestOptions): APIPromise<T.ApiKey>;
|
|
58
|
+
/**
|
|
59
|
+
* Get an API key
|
|
60
|
+
*
|
|
61
|
+
* Returns one key's metadata, spend this period and last use. The secret is never returned.
|
|
62
|
+
*
|
|
63
|
+
* `GET /v1/keys/{key_id}` · scope `platform:read` · served by beta-api.b3os.org
|
|
64
|
+
*/
|
|
65
|
+
getKey(keyId: string, options?: RequestOptions): APIPromise<T.ApiKey>;
|
|
66
|
+
/**
|
|
67
|
+
* Update an API key
|
|
68
|
+
*
|
|
69
|
+
* Renames a key or changes its spend cap, expiry or metadata. Scopes cannot change; create a new key instead.
|
|
70
|
+
* A caller with a spend cap or an expiry cannot set a larger cap or a later (or no) expiry than its own
|
|
71
|
+
* (`forbidden`, reason `scope_escalation`).
|
|
72
|
+
*
|
|
73
|
+
* `PATCH /v1/keys/{key_id}` · scope `platform:write` · served by beta-api.b3os.org
|
|
74
|
+
*/
|
|
75
|
+
updateKey(keyId: string, body: T.ApiKeyUpdateRequest, options?: RequestOptions): APIPromise<T.ApiKey>;
|
|
76
|
+
}
|