@b3os/sdk 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +233 -2
  3. package/dist/cjs/core/client.d.ts +165 -0
  4. package/dist/cjs/core/client.js +825 -0
  5. package/dist/cjs/core/client.js.map +1 -0
  6. package/dist/cjs/core/errors.d.ts +101 -0
  7. package/dist/cjs/core/errors.js +249 -0
  8. package/dist/cjs/core/errors.js.map +1 -0
  9. package/dist/cjs/core/index.d.ts +12 -0
  10. package/dist/cjs/core/index.js +42 -0
  11. package/dist/cjs/core/index.js.map +1 -0
  12. package/dist/cjs/core/jobs.d.ts +31 -0
  13. package/dist/cjs/core/jobs.js +72 -0
  14. package/dist/cjs/core/jobs.js.map +1 -0
  15. package/dist/cjs/core/namespace.d.ts +7 -0
  16. package/dist/cjs/core/namespace.js +13 -0
  17. package/dist/cjs/core/namespace.js.map +1 -0
  18. package/dist/cjs/core/op.d.ts +47 -0
  19. package/dist/cjs/core/op.js +5 -0
  20. package/dist/cjs/core/op.js.map +1 -0
  21. package/dist/cjs/core/promise.d.ts +106 -0
  22. package/dist/cjs/core/promise.js +200 -0
  23. package/dist/cjs/core/promise.js.map +1 -0
  24. package/dist/cjs/core/response.d.ts +54 -0
  25. package/dist/cjs/core/response.js +92 -0
  26. package/dist/cjs/core/response.js.map +1 -0
  27. package/dist/cjs/core/sse.d.ts +79 -0
  28. package/dist/cjs/core/sse.js +291 -0
  29. package/dist/cjs/core/sse.js.map +1 -0
  30. package/dist/cjs/core/timing.d.ts +20 -0
  31. package/dist/cjs/core/timing.js +96 -0
  32. package/dist/cjs/core/timing.js.map +1 -0
  33. package/dist/cjs/core/transport.d.ts +80 -0
  34. package/dist/cjs/core/transport.js +472 -0
  35. package/dist/cjs/core/transport.js.map +1 -0
  36. package/dist/cjs/core/util.d.ts +25 -0
  37. package/dist/cjs/core/util.js +142 -0
  38. package/dist/cjs/core/util.js.map +1 -0
  39. package/dist/cjs/core/ws.d.ts +52 -0
  40. package/dist/cjs/core/ws.js +181 -0
  41. package/dist/cjs/core/ws.js.map +1 -0
  42. package/dist/cjs/generated/client.d.ts +62 -0
  43. package/dist/cjs/generated/client.js +130 -0
  44. package/dist/cjs/generated/client.js.map +1 -0
  45. package/dist/cjs/generated/errors.d.ts +4 -0
  46. package/dist/cjs/generated/errors.js +160 -0
  47. package/dist/cjs/generated/errors.js.map +1 -0
  48. package/dist/cjs/generated/ids.d.ts +114 -0
  49. package/dist/cjs/generated/ids.js +47 -0
  50. package/dist/cjs/generated/ids.js.map +1 -0
  51. package/dist/cjs/generated/jobs.d.ts +10 -0
  52. package/dist/cjs/generated/jobs.js +24 -0
  53. package/dist/cjs/generated/jobs.js.map +1 -0
  54. package/dist/cjs/generated/ns/actions.d.ts +161 -0
  55. package/dist/cjs/generated/ns/actions.js +304 -0
  56. package/dist/cjs/generated/ns/actions.js.map +1 -0
  57. package/dist/cjs/generated/ns/infer.d.ts +190 -0
  58. package/dist/cjs/generated/ns/infer.js +253 -0
  59. package/dist/cjs/generated/ns/infer.js.map +1 -0
  60. package/dist/cjs/generated/ns/keys.d.ts +76 -0
  61. package/dist/cjs/generated/ns/keys.js +144 -0
  62. package/dist/cjs/generated/ns/keys.js.map +1 -0
  63. package/dist/cjs/generated/ns/limits.d.ts +22 -0
  64. package/dist/cjs/generated/ns/limits.js +32 -0
  65. package/dist/cjs/generated/ns/limits.js.map +1 -0
  66. package/dist/cjs/generated/ns/orgs.d.ts +38 -0
  67. package/dist/cjs/generated/ns/orgs.js +68 -0
  68. package/dist/cjs/generated/ns/orgs.js.map +1 -0
  69. package/dist/cjs/generated/ns/projects.d.ts +57 -0
  70. package/dist/cjs/generated/ns/projects.js +115 -0
  71. package/dist/cjs/generated/ns/projects.js.map +1 -0
  72. package/dist/cjs/generated/ns/render.d.ts +159 -0
  73. package/dist/cjs/generated/ns/render.js +299 -0
  74. package/dist/cjs/generated/ns/render.js.map +1 -0
  75. package/dist/cjs/generated/ns/requests.d.ts +36 -0
  76. package/dist/cjs/generated/ns/requests.js +54 -0
  77. package/dist/cjs/generated/ns/requests.js.map +1 -0
  78. package/dist/cjs/generated/ns/routines.d.ts +212 -0
  79. package/dist/cjs/generated/ns/routines.js +419 -0
  80. package/dist/cjs/generated/ns/routines.js.map +1 -0
  81. package/dist/cjs/generated/ns/sandboxes.d.ts +318 -0
  82. package/dist/cjs/generated/ns/sandboxes.js +549 -0
  83. package/dist/cjs/generated/ns/sandboxes.js.map +1 -0
  84. package/dist/cjs/generated/ns/usage.d.ts +30 -0
  85. package/dist/cjs/generated/ns/usage.js +49 -0
  86. package/dist/cjs/generated/ns/usage.js.map +1 -0
  87. package/dist/cjs/generated/ns/vault.d.ts +69 -0
  88. package/dist/cjs/generated/ns/vault.js +122 -0
  89. package/dist/cjs/generated/ns/vault.js.map +1 -0
  90. package/dist/cjs/generated/ns/vision.d.ts +376 -0
  91. package/dist/cjs/generated/ns/vision.js +736 -0
  92. package/dist/cjs/generated/ns/vision.js.map +1 -0
  93. package/dist/cjs/generated/ns/webhooks.d.ts +50 -0
  94. package/dist/cjs/generated/ns/webhooks.js +91 -0
  95. package/dist/cjs/generated/ns/webhooks.js.map +1 -0
  96. package/dist/cjs/generated/types.d.ts +4613 -0
  97. package/dist/cjs/generated/types.js +4 -0
  98. package/dist/cjs/generated/types.js.map +1 -0
  99. package/dist/cjs/index.d.ts +22 -0
  100. package/dist/cjs/index.js +81 -0
  101. package/dist/cjs/index.js.map +1 -0
  102. package/dist/cjs/package.json +3 -0
  103. package/dist/cjs/webhooks.d.ts +19 -0
  104. package/dist/cjs/webhooks.js +85 -0
  105. package/dist/cjs/webhooks.js.map +1 -0
  106. package/dist/esm/core/client.d.ts +165 -0
  107. package/dist/esm/core/client.js +821 -0
  108. package/dist/esm/core/client.js.map +1 -0
  109. package/dist/esm/core/errors.d.ts +101 -0
  110. package/dist/esm/core/errors.js +239 -0
  111. package/dist/esm/core/errors.js.map +1 -0
  112. package/dist/esm/core/index.d.ts +12 -0
  113. package/dist/esm/core/index.js +15 -0
  114. package/dist/esm/core/index.js.map +1 -0
  115. package/dist/esm/core/jobs.d.ts +31 -0
  116. package/dist/esm/core/jobs.js +66 -0
  117. package/dist/esm/core/jobs.js.map +1 -0
  118. package/dist/esm/core/namespace.d.ts +7 -0
  119. package/dist/esm/core/namespace.js +9 -0
  120. package/dist/esm/core/namespace.js.map +1 -0
  121. package/dist/esm/core/op.d.ts +47 -0
  122. package/dist/esm/core/op.js +4 -0
  123. package/dist/esm/core/op.js.map +1 -0
  124. package/dist/esm/core/promise.d.ts +106 -0
  125. package/dist/esm/core/promise.js +193 -0
  126. package/dist/esm/core/promise.js.map +1 -0
  127. package/dist/esm/core/response.d.ts +54 -0
  128. package/dist/esm/core/response.js +86 -0
  129. package/dist/esm/core/response.js.map +1 -0
  130. package/dist/esm/core/sse.d.ts +79 -0
  131. package/dist/esm/core/sse.js +286 -0
  132. package/dist/esm/core/sse.js.map +1 -0
  133. package/dist/esm/core/timing.d.ts +20 -0
  134. package/dist/esm/core/timing.js +92 -0
  135. package/dist/esm/core/timing.js.map +1 -0
  136. package/dist/esm/core/transport.d.ts +80 -0
  137. package/dist/esm/core/transport.js +465 -0
  138. package/dist/esm/core/transport.js.map +1 -0
  139. package/dist/esm/core/util.d.ts +25 -0
  140. package/dist/esm/core/util.js +128 -0
  141. package/dist/esm/core/util.js.map +1 -0
  142. package/dist/esm/core/ws.d.ts +52 -0
  143. package/dist/esm/core/ws.js +175 -0
  144. package/dist/esm/core/ws.js.map +1 -0
  145. package/dist/esm/generated/client.d.ts +62 -0
  146. package/dist/esm/generated/client.js +126 -0
  147. package/dist/esm/generated/client.js.map +1 -0
  148. package/dist/esm/generated/errors.d.ts +4 -0
  149. package/dist/esm/generated/errors.js +157 -0
  150. package/dist/esm/generated/errors.js.map +1 -0
  151. package/dist/esm/generated/ids.d.ts +114 -0
  152. package/dist/esm/generated/ids.js +42 -0
  153. package/dist/esm/generated/ids.js.map +1 -0
  154. package/dist/esm/generated/jobs.d.ts +10 -0
  155. package/dist/esm/generated/jobs.js +21 -0
  156. package/dist/esm/generated/jobs.js.map +1 -0
  157. package/dist/esm/generated/ns/actions.d.ts +161 -0
  158. package/dist/esm/generated/ns/actions.js +300 -0
  159. package/dist/esm/generated/ns/actions.js.map +1 -0
  160. package/dist/esm/generated/ns/infer.d.ts +190 -0
  161. package/dist/esm/generated/ns/infer.js +249 -0
  162. package/dist/esm/generated/ns/infer.js.map +1 -0
  163. package/dist/esm/generated/ns/keys.d.ts +76 -0
  164. package/dist/esm/generated/ns/keys.js +140 -0
  165. package/dist/esm/generated/ns/keys.js.map +1 -0
  166. package/dist/esm/generated/ns/limits.d.ts +22 -0
  167. package/dist/esm/generated/ns/limits.js +28 -0
  168. package/dist/esm/generated/ns/limits.js.map +1 -0
  169. package/dist/esm/generated/ns/orgs.d.ts +38 -0
  170. package/dist/esm/generated/ns/orgs.js +64 -0
  171. package/dist/esm/generated/ns/orgs.js.map +1 -0
  172. package/dist/esm/generated/ns/projects.d.ts +57 -0
  173. package/dist/esm/generated/ns/projects.js +111 -0
  174. package/dist/esm/generated/ns/projects.js.map +1 -0
  175. package/dist/esm/generated/ns/render.d.ts +159 -0
  176. package/dist/esm/generated/ns/render.js +295 -0
  177. package/dist/esm/generated/ns/render.js.map +1 -0
  178. package/dist/esm/generated/ns/requests.d.ts +36 -0
  179. package/dist/esm/generated/ns/requests.js +50 -0
  180. package/dist/esm/generated/ns/requests.js.map +1 -0
  181. package/dist/esm/generated/ns/routines.d.ts +212 -0
  182. package/dist/esm/generated/ns/routines.js +415 -0
  183. package/dist/esm/generated/ns/routines.js.map +1 -0
  184. package/dist/esm/generated/ns/sandboxes.d.ts +318 -0
  185. package/dist/esm/generated/ns/sandboxes.js +545 -0
  186. package/dist/esm/generated/ns/sandboxes.js.map +1 -0
  187. package/dist/esm/generated/ns/usage.d.ts +30 -0
  188. package/dist/esm/generated/ns/usage.js +45 -0
  189. package/dist/esm/generated/ns/usage.js.map +1 -0
  190. package/dist/esm/generated/ns/vault.d.ts +69 -0
  191. package/dist/esm/generated/ns/vault.js +118 -0
  192. package/dist/esm/generated/ns/vault.js.map +1 -0
  193. package/dist/esm/generated/ns/vision.d.ts +376 -0
  194. package/dist/esm/generated/ns/vision.js +732 -0
  195. package/dist/esm/generated/ns/vision.js.map +1 -0
  196. package/dist/esm/generated/ns/webhooks.d.ts +50 -0
  197. package/dist/esm/generated/ns/webhooks.js +87 -0
  198. package/dist/esm/generated/ns/webhooks.js.map +1 -0
  199. package/dist/esm/generated/types.d.ts +4613 -0
  200. package/dist/esm/generated/types.js +3 -0
  201. package/dist/esm/generated/types.js.map +1 -0
  202. package/dist/esm/index.d.ts +22 -0
  203. package/dist/esm/index.js +28 -0
  204. package/dist/esm/index.js.map +1 -0
  205. package/dist/esm/webhooks.d.ts +19 -0
  206. package/dist/esm/webhooks.js +79 -0
  207. package/dist/esm/webhooks.js.map +1 -0
  208. package/package.json +98 -4
  209. package/src/core/client.ts +1022 -0
  210. package/src/core/errors.ts +296 -0
  211. package/src/core/index.ts +45 -0
  212. package/src/core/jobs.ts +94 -0
  213. package/src/core/namespace.ts +10 -0
  214. package/src/core/op.ts +53 -0
  215. package/src/core/promise.ts +268 -0
  216. package/src/core/response.ts +115 -0
  217. package/src/core/sse.ts +305 -0
  218. package/src/core/timing.ts +106 -0
  219. package/src/core/transport.ts +489 -0
  220. package/src/core/util.ts +138 -0
  221. package/src/core/ws.ts +215 -0
  222. package/src/generated/client.ts +143 -0
  223. package/src/generated/errors.ts +313 -0
  224. package/src/generated/ids.ts +47 -0
  225. package/src/generated/jobs.ts +25 -0
  226. package/src/generated/ns/actions.ts +353 -0
  227. package/src/generated/ns/infer.ts +332 -0
  228. package/src/generated/ns/keys.ts +152 -0
  229. package/src/generated/ns/limits.ts +35 -0
  230. package/src/generated/ns/orgs.ts +77 -0
  231. package/src/generated/ns/projects.ts +122 -0
  232. package/src/generated/ns/render.ts +348 -0
  233. package/src/generated/ns/requests.ts +61 -0
  234. package/src/generated/ns/routines.ts +474 -0
  235. package/src/generated/ns/sandboxes.ts +671 -0
  236. package/src/generated/ns/usage.ts +56 -0
  237. package/src/generated/ns/vault.ts +136 -0
  238. package/src/generated/ns/vision.ts +836 -0
  239. package/src/generated/ns/webhooks.ts +100 -0
  240. package/src/generated/types.ts +5131 -0
  241. package/src/index.ts +30 -0
  242. 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,0DAAoD;AAKpD,MAAM,MAAM,GAAO;IACjB,EAAE,EAAE,aAAa;IACjB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,aAAa;CACrB,CAAC;AACF,MAAM,UAAU,GAAO;IACrB,EAAE,EAAE,iBAAiB;IACrB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,sBAAsB;IAC5B,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,cAAc;CACtB,CAAC;AACF,MAAM,WAAW,GAAO;IACtB,EAAE,EAAE,kBAAkB;IACtB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,cAAc;CACtB,CAAC;AACF,MAAM,SAAS,GAAO;IACpB,EAAE,EAAE,gBAAgB;IACpB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,sCAAsC;IAC5C,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,cAAc;CACtB,CAAC;AACF,MAAM,iBAAiB,GAAO;IAC5B,EAAE,EAAE,wBAAwB;IAC5B,MAAM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AAE,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;AAnND,gCAmNC"}
@@ -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,253 @@
1
+ "use strict";
2
+ // Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.InferAPI = exports.inferOps = void 0;
5
+ const namespace_ts_1 = require("../../core/namespace.js");
6
+ const createSpeechOp = {
7
+ id: "inferCreateSpeech",
8
+ method: "POST",
9
+ path: "/v1/infer/audio/speech",
10
+ body: "json",
11
+ timeoutMs: 65000,
12
+ errorFormat: "openai",
13
+ scope: "infer:run",
14
+ };
15
+ const listVoicesOp = {
16
+ id: "inferListVoices",
17
+ method: "GET",
18
+ path: "/v1/infer/audio/voices",
19
+ timeoutMs: 10000,
20
+ scope: "infer:read",
21
+ };
22
+ const createChatCompletionOp = {
23
+ id: "inferCreateChatCompletion",
24
+ method: "POST",
25
+ path: "/v1/infer/chat/completions",
26
+ body: "json",
27
+ stream: "sse",
28
+ timeoutMs: 600000,
29
+ errorFormat: "openai",
30
+ scope: "infer:run",
31
+ };
32
+ const createEmbeddingsOp = {
33
+ id: "inferCreateEmbeddings",
34
+ method: "POST",
35
+ path: "/v1/infer/embeddings",
36
+ body: "json",
37
+ timeoutMs: 65000,
38
+ errorFormat: "openai",
39
+ stretch: true,
40
+ scope: "infer:run",
41
+ };
42
+ const listModelsOp = {
43
+ id: "inferListModels",
44
+ method: "GET",
45
+ path: "/v1/infer/models",
46
+ timeoutMs: 10000,
47
+ errorFormat: "openai",
48
+ scope: "infer:read",
49
+ };
50
+ const getModelOp = {
51
+ id: "inferGetModel",
52
+ method: "GET",
53
+ path: "/v1/infer/models/{model}",
54
+ params: ["model"],
55
+ wildcard: "model",
56
+ timeoutMs: 10000,
57
+ errorFormat: "openai",
58
+ scope: "infer:read",
59
+ };
60
+ const createResponseOp = {
61
+ id: "inferCreateResponse",
62
+ method: "POST",
63
+ path: "/v1/infer/responses",
64
+ body: "json",
65
+ stream: "sse",
66
+ timeoutMs: 600000,
67
+ errorFormat: "openai",
68
+ stretch: true,
69
+ scope: "infer:run",
70
+ };
71
+ const createMessageOp = {
72
+ id: "inferCreateMessage",
73
+ method: "POST",
74
+ path: "/v1/infer/v1/messages",
75
+ body: "json",
76
+ stream: "sse",
77
+ timeoutMs: 600000,
78
+ errorFormat: "openai",
79
+ stretch: true,
80
+ scope: "infer:run",
81
+ };
82
+ const countMessageTokensOp = {
83
+ id: "inferCountMessageTokens",
84
+ method: "POST",
85
+ path: "/v1/infer/v1/messages/count_tokens",
86
+ body: "json",
87
+ timeoutMs: 30000,
88
+ errorFormat: "openai",
89
+ stretch: true,
90
+ scope: "infer:run",
91
+ };
92
+ /** Descriptors of every infer operation, keyed by method name (for tooling and custom clients). */
93
+ exports.inferOps = {
94
+ createSpeech: createSpeechOp,
95
+ listVoices: listVoicesOp,
96
+ createChatCompletion: createChatCompletionOp,
97
+ createEmbeddings: createEmbeddingsOp,
98
+ listModels: listModelsOp,
99
+ getModel: getModelOp,
100
+ createResponse: createResponseOp,
101
+ createMessage: createMessageOp,
102
+ countMessageTokens: countMessageTokensOp,
103
+ };
104
+ /** Models on the node: OpenAI-compatible chat, embeddings and speech (`/v1/infer`). */
105
+ class InferAPI extends namespace_ts_1.Namespace {
106
+ createSpeech(body, options = {}) {
107
+ if (body.timestamps === "word") {
108
+ return this._client._call(createSpeechOp, { body }, options);
109
+ }
110
+ return this._client._call(createSpeechOp, { body }, options, "audio/mpeg, audio/wav, audio/pcm, audio/ogg, audio/aac, audio/flac", "bytes");
111
+ }
112
+ /**
113
+ * List voices
114
+ *
115
+ * Lists the voices each speech model offers, with language and an audio sample. A B3OS endpoint (not part of
116
+ * the OpenAI API), so it uses B3OS lists and errors: `503 infer_backend_unavailable` with `Retry-After` while
117
+ * the voice service is down. All voices arrive in one page (`next_cursor` is always `null`).
118
+ *
119
+ * `GET /v1/infer/audio/voices` · scope `infer:read` · served by the node
120
+ */
121
+ listVoices(params, options) {
122
+ return this._client._call(listVoicesOp, { query: params }, options);
123
+ }
124
+ createChatCompletion(body, options = {}) {
125
+ if (body.stream) {
126
+ return this._client._postStream(createChatCompletionOp, { body }, options, {
127
+ doneSentinel: true,
128
+ });
129
+ }
130
+ return this._client._call(createChatCompletionOp, { body }, options);
131
+ }
132
+ /**
133
+ * Create embeddings
134
+ *
135
+ * The OpenAI Embeddings API, for embedding models the node serves (`b3os.kind` is `embedding`). Other models
136
+ * return `404 model_not_available`; the beta node serves no embedding model yet. Bills input tokens.
137
+ *
138
+ * `POST /v1/infer/embeddings` · scope `infer:run` · served by the node
139
+ *
140
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
141
+ */
142
+ createEmbeddings(body, options) {
143
+ return this._client._call(createEmbeddingsOp, { body }, options);
144
+ }
145
+ /**
146
+ * List models
147
+ *
148
+ * The OpenAI model list for the models this node serves, each with a `b3os` object: context length,
149
+ * quantization, whether it supports tools, JSON Schema output and image input, the largest accepted request,
150
+ * and your per-model token and request limits. Chat models are listed while the node's model runtime is
151
+ * configured (one that is restarting is still listed; requests get `503` with `Retry-After`); speech models
152
+ * while the voice service answers.
153
+ *
154
+ * `GET /v1/infer/models` · scope `infer:read` · served by the node
155
+ */
156
+ listModels(options) {
157
+ return this._client._call(listModelsOp, {}, options);
158
+ }
159
+ /**
160
+ * Get a model
161
+ *
162
+ * One model from the list, by ID. IDs may contain a slash (`b3os/qwen3.5-9b`); send it unencoded.
163
+ *
164
+ * `GET /v1/infer/models/{model}` · scope `infer:read` · served by the node
165
+ */
166
+ getModel(model, options) {
167
+ return this._client._call(getModelOp, { path: [model] }, options);
168
+ }
169
+ /**
170
+ * Create a response (OpenAI Responses API)
171
+ *
172
+ * A stateless subset of the OpenAI Responses API on the node's own models, for SDKs and agent frameworks that
173
+ * speak Responses (the OpenAI Agents SDK among them) with only the base URL changed: `input` as a string or
174
+ * as items (`message` with `input_text` and `input_image` parts, or `output_text` for assistant turns;
175
+ * `function_call`, `function_call_output` and `reasoning` items), `instructions`, function tools with
176
+ * `tool_choice` and `parallel_tool_calls`, structured output through `text.format` (`json_schema`,
177
+ * `json_object`), `reasoning.effort` (`low` and above turn the model's reasoning phase on; its text arrives
178
+ * in `reasoning` items), `max_output_tokens`, `temperature`, `top_p`, and the Responses event stream
179
+ * (`response.created` ... `response.completed`, as OpenAI sends them).
180
+ *
181
+ * Nothing is stored: send the whole conversation as `input` items each turn. `previous_response_id`,
182
+ * `conversation`, `prompt`, `background: true` and `truncation: "auto"` are `400 unsupported_parameter`;
183
+ * `store`, `metadata` (echoed), `user`, `safety_identifier`, `prompt_cache_key`, `service_tier`,
184
+ * `text.verbosity`, `reasoning.summary` and `include: ["reasoning.encrypted_content"]` are accepted and
185
+ * ignored, and every response reports `store: false`. Tools other than `function` (web search, file
186
+ * search, computer use, code interpreter, MCP, image generation, shell) run on OpenAI's side and are
187
+ * `400 unsupported_parameter`. `null` means unset for every optional parameter. Images and JSON Schemas
188
+ * have the limits of chat completions. A stream that fails after it started ends with an `error` event; one
189
+ * that fails before the first token is a plain HTTP error. The response head of a stream waits for the
190
+ * first generated token, so `Server-Timing` can carry `ttft`.
191
+ *
192
+ * Bills input and output tokens, with the admission and limits of chat completions (the estimated prompt
193
+ * plus `max_output_tokens`, else 512 tokens, settled with the real counts; an abandoned stream is billed to
194
+ * its last token).
195
+ *
196
+ * `POST /v1/infer/responses` · scope `infer:run` · served by the node
197
+ *
198
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
199
+ */
200
+ createResponse(body, options) {
201
+ return this._client._call(createResponseOp, { body }, options);
202
+ }
203
+ /**
204
+ * Create a message (Anthropic Messages API)
205
+ *
206
+ * The Anthropic Messages API on the node's own model, so Anthropic SDKs and agents built on them run against
207
+ * it with only the base URL and the credential changed: set `ANTHROPIC_BASE_URL` (or `base_url`) to
208
+ * `https://beta-api.b3os.org/v1/infer`, the same base URL as the OpenAI SDKs (`http://127.0.0.1:7700/v1/infer`
209
+ * inside a sandbox; the SDKs add `/v1/messages`), and send the B3OS key as a bearer token
210
+ * (`ANTHROPIC_AUTH_TOKEN`, or `auth_token` in the SDKs). Text, images (`base64`, or `url` sources fetched by
211
+ * the node through its egress guard), custom tools with `tool_use` and `tool_result` blocks, `tool_choice`,
212
+ * `thinking` (the reasoning arrives in `thinking` blocks; `budget_tokens` caps it), JSON Schema output
213
+ * through `output_config.format`, stop sequences, a trailing assistant turn that the model continues, and
214
+ * streaming events (`message_start` ... `message_stop`, exactly as Anthropic sends them). Models are those
215
+ * of `GET /v1/infer/models`; there is no gateway route here.
216
+ *
217
+ * Parameters this node does not take return `400 unsupported_parameter` (tools Anthropic defines or runs,
218
+ * such as `web_search` or `bash`, `container`, `mcp_servers`, document and file sources).
219
+ * `cache_control`, `citations`, `metadata`, `service_tier`, `output_config.effort` and `thinking.display`
220
+ * are accepted and ignored (the runtime caches prompt prefixes on its own). Errors use the Anthropic shape
221
+ * (`{"type": "error", "error": {...}}`, with the B3OS code under `b3os`), except those raised before the
222
+ * request reaches the infer service (authentication, scopes, body size), which use the OpenAI shape of the
223
+ * rest of `/v1/infer`; Anthropic SDKs map both by HTTP status. A stream that fails after it started ends
224
+ * with an `error` event; one that fails before the first token is a plain HTTP error. The response head of
225
+ * a stream waits for the first generated token, so `Server-Timing` can carry `ttft`.
226
+ *
227
+ * Bills input and output tokens, with the admission and limits of chat completions (the estimated prompt
228
+ * plus `max_tokens`, settled with the real counts; an abandoned stream is billed to its last token).
229
+ *
230
+ * `POST /v1/infer/v1/messages` · scope `infer:run` · served by the node
231
+ *
232
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
233
+ */
234
+ createMessage(body, options) {
235
+ return this._client._call(createMessageOp, { body }, options);
236
+ }
237
+ /**
238
+ * Count the tokens of a message request
239
+ *
240
+ * The Anthropic token-counting API: the input tokens a Messages request with the same `messages`, `system`,
241
+ * `tools`, `tool_choice` and `thinking` would use, counted by the model runtime with the model's own chat
242
+ * template (images included). Free: it counts against your requests per minute, not your tokens.
243
+ *
244
+ * `POST /v1/infer/v1/messages/count_tokens` · scope `infer:run` · served by the node
245
+ *
246
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
247
+ */
248
+ countMessageTokens(body, options) {
249
+ return this._client._call(countMessageTokensOp, { body }, options);
250
+ }
251
+ }
252
+ exports.InferAPI = InferAPI;
253
+ //# 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,0DAAoD;AAMpD,MAAM,cAAc,GAAO;IACzB,EAAE,EAAE,mBAAmB;IACvB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,KAAK;IAChB,WAAW,EAAE,QAAQ;IACrB,KAAK,EAAE,WAAW;CACnB,CAAC;AACF,MAAM,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AgB,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;AA7ND,4BA6NC"}
@@ -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
+ }