@runinfra/sdk 0.1.3 → 0.2.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/CHANGELOG.md CHANGED
@@ -3,75 +3,101 @@
3
3
  All notable changes to `@runinfra/sdk` are documented here. This project follows
4
4
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [0.2.0] - 2026-06-15
7
+
8
+ ### Added
9
+ - `InsufficientCreditsError` now exposes `currentBalanceCents`, `requiredCents`,
10
+ and `topupUrl` when the gateway includes them on a `402` response, so callers
11
+ can render a precise top-up prompt without parsing the message string.
12
+
13
+ ### Changed
14
+ - `PermissionDeniedError.type` now preserves a specific gateway discriminator on
15
+ `403` responses (for example `byoc_plan_required` when a workspace below the
16
+ deploy tier calls a BYOC-deployed endpoint) instead of always reporting
17
+ `permission_denied`. Branch on `err.type` rather than scraping `err.message`.
18
+
19
+ ## [0.1.5] - 2026-05-30
20
+
21
+ ### Added
22
+ - Added examples for chat, Responses streaming, embeddings, model discovery,
23
+ and webhook verification.
24
+ - Clarified deployment requirements for image, audio, and co-located voice
25
+ pipeline helpers.
26
+
27
+ ### Changed
28
+ - Clarified webhook helpers as local signature verification APIs. Webhook
29
+ delivery management remains outside the public SDK surface.
30
+
31
+ ## [0.1.4] - 2026-05-23
32
+
33
+ ### Added
34
+ - Added typed helpers for chat completions, Responses, embeddings, image
35
+ generation, text to speech, speech to text, model discovery, local webhook
36
+ signature verification, and co-located voice pipelines.
37
+ - Added OpenAI-style request fields for chat, Responses, embeddings, image
38
+ generation, TTS, and ASR helpers, including `extraBody` for deliberate JSON
39
+ gateway extensions.
40
+ - Added typed gateway errors for authentication, permissions, rate limits,
41
+ insufficient credits, deployment failures, missing models, timeouts,
42
+ connection failures, and malformed streams.
43
+ - Added request tracing through `X-Client-Request-Id`, response request IDs,
44
+ and idempotency keys for replay-safe chat and Responses requests.
45
+
46
+ ### Changed
47
+ - Kept the public `client.webhooks` namespace focused on local signature
48
+ verification. Verification remains available through `verifySignature`,
49
+ `constructEvent`, `verifyWebhookSignature`, and `constructWebhookEvent`.
50
+ - Closed public request body types around supported fields so typos and
51
+ unsupported direct fields fail before a network request is sent.
52
+ - Closed ASR multipart requests around explicit file, filename, language,
53
+ prompt, temperature, and response-format fields.
54
+ - Documented the Responses helper as a chat-completions compatibility adapter
55
+ instead of full OpenAI Responses state.
56
+ - Kept charge-bearing retries conservative. Embeddings, images, streaming,
57
+ binary TTS, multipart ASR, and voice-pipeline requests are sent once even
58
+ when an idempotency key is provided.
59
+
60
+ ### Security
61
+ - Hardened browser-runtime protection so secret API keys are not accepted in
62
+ public client bundles unless `dangerouslyAllowBrowser: true` is explicitly
63
+ set.
64
+ - Hardened API-key redaction in transport errors, response body errors, and
65
+ stream read errors.
66
+ - Limited the published package contents to the runtime SDK, type definitions,
67
+ README, changelog, license, and package metadata.
68
+
69
+ ### Compatibility
70
+ - `UnsupportedOperationError` remains exported for older v0.1.x consumers, but
71
+ current public helpers do not raise it.
72
+
6
73
  ## [0.1.3] - 2026-05-23
7
74
 
8
75
  ### Security
9
- - Hardened browser credential safeguards by requiring
10
- `dangerouslyAllowBrowser` to be an actual boolean and by failing closed in
11
- browser worker runtimes unless explicitly allowed.
12
- - Replaced trailing-slash URL regex normalization with a bounded loop to avoid
13
- regex backtracking risk on adversarial base URLs.
76
+ - Improved server-side API key safeguards for browser-like runtimes.
77
+ - Improved custom base URL validation for untrusted input.
14
78
 
15
79
  ### Changed
16
- - Pinned CI and publish build tooling with a TypeScript lockfile and Python
17
- dev requirements file, and pinned workflow actions to immutable commits.
18
- - Made real publish dispatch default to dry-run and require an exact version
19
- confirmation on `main`.
20
- - Extended package verification to scan shipped files for source maps, local
21
- machine paths, package tokens, private keys, and registry config leaks.
80
+ - Improved install consistency across the TypeScript and Python packages.
22
81
 
23
82
  ## [0.1.2] - 2026-05-23
24
83
 
25
84
  ### Changed
26
- - Hardened CI and publish gates with exact npm tarball and Python wheel/sdist
27
- content verification.
28
- - Added version-sync and workflow-policy checks to prevent stale SDK releases
29
- and long-lived registry-token regressions.
30
- - Updated public docs to match the shipped voice pipeline helper: experimental,
31
- pipeline-scoped, and not yet live-canary verified.
85
+ - Aligned TypeScript and Python package metadata for the same release.
86
+ - Clarified that the voice pipeline helper is a pipeline-scoped preview
87
+ surface.
32
88
 
33
89
  ## [0.1.1] - 2026-05-23
34
90
 
35
91
  ### Changed
36
- - **`license`**: `UNLICENSED` -> `LicenseRef-Proprietary` (aligns with Python SDK; the prior value was contradictory for a public package).
37
- - **`repository.url`**: now points at `RightNow-AI/runinfra-sdk` (the public source repo). Previous value pointed at the non-existent `RunPipe` slug.
38
- - **`bugs.url`**: same fix.
39
- - **`description`**: now states "beta; LLM + embeddings tested, image/audio surfaces experimental" so the registry listing accurately reflects verification state.
92
+ - Used the proprietary license reference consistently across TypeScript and
93
+ Python packages.
94
+ - Updated repository and issue URLs to point at the public SDK repo.
95
+ - Clarified package status as beta while image and audio helpers remain
96
+ deployment-dependent preview surfaces.
40
97
 
41
98
  ### Added
42
- - **Modality status section** in the README documenting which surfaces are
43
- contract-tested vs experimental.
44
- - **`@experimental` JSDoc** on `client.images.*`, `client.audio.speech.*`, and
45
- `client.audio.transcriptions.*` - these surfaces match the OpenAI HTTP
46
- envelope but have not been verified end-to-end against a live deployed
47
- pipeline in the public-gateway canary suite. Test against your own
48
- deployments before using in production.
49
- - This `CHANGELOG.md`.
50
-
51
- ### Provenance
52
- This is the first release published via GitHub OIDC trusted publishing
53
- (`.github/workflows/publish.yml` -> `npm` environment). The published
54
- tarball includes a Sigstore-backed provenance attestation that ties the
55
- release to a specific CI run. Verify with:
56
- ```bash
57
- npm view @runinfra/sdk@0.1.1 dist.attestations
58
- ```
59
- v0.1.0 was published from a local machine to bootstrap the Trusted Publisher
60
- configuration and does not have provenance. All v0.1.1+ releases will.
61
-
62
- ### Known beta gaps
63
- - Live-canary coverage is currently restricted to LLM + embeddings. Image,
64
- TTS, and ASR surfaces are runnable but not yet verified end-to-end.
65
- - Webhook delivery routes are not shipped; `client.webhooks.create` /
66
- `.list()` throw `UnsupportedOperationError`. Local signature verification
67
- (`verifySignature`, `constructEvent`) works.
68
- - `client.voice.pipeline.create` posts audio to the pipeline-scoped `/pipeline` route.
69
- It is experimental until live canary coverage is complete.
70
-
71
- ### Toward 1.0.0 GA
72
- GA requires all 5 model modalities plus voice pipeline live-canary verified and
73
- public-repo release gates that block stale, missing, or bypassed canary
74
- evidence.
99
+ - Added the modality status section to the README.
100
+ - Added preview JSDoc annotations for deployment-dependent helpers.
75
101
 
76
102
  ## [0.1.0] - 2026-05-22
77
103
 
package/README.md CHANGED
@@ -10,40 +10,34 @@ Requires Node.js 18 or newer.
10
10
  npm install @runinfra/sdk
11
11
  ```
12
12
 
13
- ## Modality status (v0.1.3)
13
+ ## Modality status (v0.2.0)
14
14
 
15
15
  This SDK is in **beta**. The surfaces below have different verification levels:
16
16
 
17
17
  | Modality | Surface | Status |
18
18
  |---|---|---|
19
- | LLM | `client.chat.completions.create`, `client.responses.create` | Beta, contract-tested |
20
- | Embeddings | `client.embeddings.create` | Beta, contract-tested |
21
- | Images | `client.images.generate` | **Experimental**, not live-canary verified |
22
- | Audio (TTS) | `client.audio.speech.create` | **Experimental**, not live-canary verified |
23
- | Audio (ASR) | `client.audio.transcriptions.create` | **Experimental**, not live-canary verified |
24
- | Webhooks | `client.webhooks.*` | Local verification helpers only; remote delivery not shipped |
25
- | Voice pipeline | `client.voice.pipeline.create` | **Experimental**, pipeline-scoped route, not live-canary verified |
26
-
27
- Experimental surfaces match their documented gateway contracts, but we have
28
- not yet completed a full end-to-end live-canary deployment for those
29
- modalities in the public gateway. They will reach GA in v1.0.0 once the
30
- canary suite covers all five model modalities plus voice pipeline. Test
31
- against your own deployed models before using experimental surfaces in
32
- production.
19
+ | LLM | `client.chat.completions.create`, `client.responses.create` | Beta. Typed helpers for verified LLM and vision-language deployments. |
20
+ | Embeddings | `client.embeddings.create` | Beta. Typed helper for verified embedding deployments. |
21
+ | Images | `client.images.generate` | Preview. Available when the deployment exposes image generation. |
22
+ | Audio (TTS) | `client.audio.speech.create` | Preview. Available when the deployment exposes speech generation. |
23
+ | Audio (ASR) | `client.audio.transcriptions.create` | Preview. Available when the deployment exposes transcription. |
24
+ | Webhooks | `client.webhooks.verifySignature`, `client.webhooks.constructEvent`, `verifyWebhookSignature`, `constructWebhookEvent` | Local verification helpers only; delivery management is outside the public SDK surface |
25
+ | Voice pipeline | `client.voice.pipeline.create` | Preview. Pipeline-scoped helper for co-located audio-to-response deployments. |
26
+
27
+ The dashboard only shows snippets for operations the selected deployment
28
+ supports. If a route is unsupported for a deployment, the SDK returns a typed
29
+ error instead of silently falling back to another operation.
33
30
 
34
31
  ## Create a client
35
32
 
36
33
  Use a workspace-scoped key to reach verified active deployments through the `model` field.
37
- In RunPipe, open Settings, API Keys, Create key, and keep Scope set to Workspace.
34
+ In the RunInfra dashboard, open Settings, API Keys, Create key, and keep Scope set to Workspace.
38
35
 
39
36
  The Deploy tab can create a pipeline-scoped key for one optimized pipeline.
40
37
  The one-time secret is shown once after creation. Store it as `RUNINFRA_API_KEY`
41
- for app snippets before leaving the page. For repo live canaries, keep the
42
- workspace key in `RUNINFRA_API_KEY` and put the pipeline-scoped key for
43
- `TEST_PIPELINE_ID` in `RUNINFRA_PIPELINE_API_KEY` so flat and pipeline routes
44
- are verified independently.
38
+ for app snippets before leaving the page.
45
39
 
46
- After a runbook finishes in RunPipe, choose Open Deploy from the runbook handoff.
40
+ After an optimization run finishes, open the Deploy view from the dashboard.
47
41
  Deploy only shows SDK operations that the verified endpoint supports, so copy
48
42
  the native or OpenAI-compatible snippet from there instead of guessing a route.
49
43
 
@@ -72,7 +66,7 @@ const client = new RunInfra({
72
66
 
73
67
  The default base URL is `https://api.runinfra.ai/v1`.
74
68
  `pipelineId` is trimmed and URL-encoded before it is added to the base URL. Use either `pipelineId` with the default base URL, or a pipeline-scoped `baseURL` such as `https://api.runinfra.ai/v1/pipe_123`. If both point to the same pipeline, the SDK keeps the URL scoped once.
75
- RunPipe generated native SDK snippets prefer `pipelineId` with the root `https://api.runinfra.ai/v1` base URL. OpenAI-compatible snippets use the pipeline-scoped base URL because the OpenAI SDK has no RunInfra pipeline option.
69
+ RunInfra generated native SDK snippets prefer `pipelineId` with the root `https://api.runinfra.ai/v1` base URL. OpenAI-compatible snippets use the pipeline-scoped base URL because the OpenAI SDK has no RunInfra pipeline option.
76
70
  Custom base URLs must use `http` or `https`. Other schemes and malformed URLs are rejected before a bearer API key can be sent.
77
71
  Remote custom base URLs must use `https`. Plain `http` is accepted only for local development hosts: `localhost`, `127.0.0.1`, `0.0.0.0`, and `[::1]`.
78
72
  Custom base URLs must not include usernames or passwords.
@@ -80,7 +74,15 @@ Custom base URLs must not include query strings or fragments.
80
74
 
81
75
  ## Server-side only
82
76
 
83
- The TypeScript SDK targets Node.js 18 or newer. RunInfra API keys are bearer secrets. Do not initialize this SDK in browser code with a secret API key. The SDK fails closed when it detects a browser runtime; keep calls on a Node.js server route, API service, or backend job. If you are deliberately using a controlled non-public browser-like runtime, pass `dangerouslyAllowBrowser: true` and own that risk.
77
+ The TypeScript SDK targets Node.js 18 or newer. RunInfra API keys are bearer
78
+ secrets. Do not put `RUNINFRA_API_KEY` in browser code and do not initialize
79
+ this SDK in public client bundles with a secret API key. The SDK fails closed
80
+ when it detects a browser runtime; keep calls on a Node.js server route,
81
+ backend proxy, API service, or backend job. Browser apps should call your own
82
+ server first, then your server calls RunInfra with the workspace or
83
+ pipeline-scoped key. Direct browser token flows are not supported by the public
84
+ SDK. If you are deliberately using a controlled non-public browser-like runtime,
85
+ pass `dangerouslyAllowBrowser: true` and own that risk.
84
86
 
85
87
  Unknown TypeScript client option keys are rejected so typos such as `baseUrl` or `api_key` do not silently change the gateway, authentication, timeout, retry, or runtime-safety behavior. Use `baseURL` for custom server-side gateway URLs.
86
88
 
@@ -103,6 +105,14 @@ for await (const event of stream) {
103
105
  console.log(stream.requestId);
104
106
  ```
105
107
 
108
+ Breaking out of the `for await` loop cancels the underlying SSE reader and
109
+ releases the reader lock. If you manually advance the stream iterator, call
110
+ `return()` on that iterator when you stop early so local response resources are
111
+ released. Streaming transport-level backend cancellation is best effort, and
112
+ streaming calls are not automatically retried.
113
+
114
+ RunInfra `/v1/responses` is a chat-completions compatibility adapter. The gateway converts supported `input` and `instructions` values into chat messages, forwards the supported request through the chat-completions serving path, and rewraps the result into a Responses-style envelope. It does not claim full OpenAI Responses state, include, reasoning, tool, conversation-item, or background-job semantics.
115
+
106
116
  ## Supported public routes
107
117
 
108
118
  - `models.list()`
@@ -115,6 +125,45 @@ console.log(stream.requestId);
115
125
  - `images.generate()`
116
126
  - `voice.pipeline.create()`
117
127
 
128
+ ## OpenAI-compatible parameter scope
129
+
130
+ The native SDK validates the minimum request fields locally, then forwards
131
+ OpenAI-style JSON or multipart fields that preserve the typed response shape.
132
+ The typed native SDK subset is:
133
+
134
+ - Chat Completions: `model`, `messages`, `stream`, `temperature`, `top_p`,
135
+ `max_tokens`, `stop`, `presence_penalty`, `frequency_penalty`, `user`, and
136
+ `metadata`; streaming usage chunks are covered separately with
137
+ `stream_options.include_usage`.
138
+ - Responses: `model`, `input`, `stream`, `instructions`, `temperature`,
139
+ `top_p`, `tools`, `tool_choice`, `response_format`, and `max_output_tokens`.
140
+ - Embeddings: `model`, `input`, `encoding_format: "float"`, and `dimensions`
141
+ when the deployed embedding backend advertises dimension control.
142
+ - Images: `model`, `prompt`, `n`, plus optional `size` and `response_format`
143
+ when the deployed image backend advertises them.
144
+ - Image `quality`, `style`, and `user` are typed pass-through OpenAI-style
145
+ options when the deployed image backend supports them.
146
+ - Audio speech: `model`, `input`, `voice` or `ref_audio` plus `ref_text`, and
147
+ optional `task_type` and `response_format`.
148
+ - Audio transcriptions: `model`, `file`, `filename`, optional `language`,
149
+ optional `prompt`, and JSON response formats only.
150
+
151
+ The native typed helpers do not claim GA support for tool calls, structured
152
+ JSON schema outputs, logprobs, seeds, service tiers, parallel tool calls,
153
+ Responses state/include/reasoning controls, embedding base64 output, image
154
+ streaming or partial images, audio streaming, audio translations, or direct
155
+ browser API-key use. Embedding
156
+ `encoding_format` values other than `"float"` and transcription
157
+ `response_format` values other than `"json"` or `"verbose_json"` are rejected
158
+ locally because they would not match the typed native SDK response objects.
159
+ Unsupported OpenAI-style body parameters must fail with a clear traced 4xx
160
+ gateway error.
161
+
162
+ LLM pass-through options are typed for parity with the Python SDK and OpenAI-style
163
+ request shapes, but actual support depends on the deployed backend.
164
+ Embedding `user`, TTS `speed`, and ASR `temperature` are typed pass-through
165
+ options for SDK parity, but actual support depends on the deployed backend.
166
+
118
167
  ## Text to speech
119
168
 
120
169
  TTS deployments can expose named voices or Base/reference-audio voice cloning.
@@ -145,6 +194,12 @@ const audio = await client.audio.speech.create({
145
194
  });
146
195
  ```
147
196
 
197
+ `RunInfraAudioResponse.stream()` exposes the native `ReadableStream<Uint8Array>`
198
+ from `fetch` without buffering it. Use it for large TTS responses when the caller
199
+ owns `getReader()`, cancellation, and slow-consumer backpressure. The SDK does
200
+ not auto-retry or replay binary TTS streams; use `arrayBuffer()` or `blob()` when
201
+ you want SDK read-timeout wrapping for a finite body.
202
+
148
203
  ## Timeouts and retries
149
204
 
150
205
  ```ts
@@ -159,17 +214,18 @@ const client = new RunInfra({
159
214
  });
160
215
  ```
161
216
 
162
- The SDK retries transient transport failures and `408`, `409`, `429`, `500`, `502`, `503`, and `504` responses for safe `GET` requests. Charge-bearing `POST` inference requests retry only when you provide `idempotencyKey`, and automatic POST retries are limited to non-streaming JSON calls whose gateway responses can be replayed safely. That covers `responses.create()`, non-streaming `chat.completions.create()`, `embeddings.create()`, and `images.generate()`. Streaming calls, binary TTS responses, and multipart ASR uploads are sent once even when you provide an idempotency key. The gateway still binds idempotency keys for TTS and ASR, so a manual retry with the same key will not run or charge a second inference after the first request settles. Automatic retries honor reasonable `Retry-After` values up to 60 seconds when the header is a plain integer second value or HTTP-date, then fall back to bounded exponential backoff. The SDK does not retry authentication errors, insufficient credits, or unsupported operations.
217
+ The SDK retries transient transport failures and `408`, `409`, `429`, `500`, `502`, `503`, and `504` responses for safe `GET` requests. Charge-bearing `POST` inference requests retry only when you provide `idempotencyKey`, and automatic POST retries are limited to non-streaming JSON calls whose gateway responses can be replayed safely. Only `responses.create()` and non-streaming `chat.completions.create()` are currently auto-retry replay-safe. Embeddings, images, streaming calls, binary TTS responses, and multipart ASR uploads are sent once even when you provide an idempotency key. Keep `maxRetries: 0` for any cost-sensitive operation whose replay behavior is not documented as safe. Automatic retries honor reasonable `Retry-After` values up to 60 seconds when the header is a plain integer second value or HTTP-date, then fall back to bounded exponential backoff. The SDK does not retry authentication errors, insufficient credits, or unsupported operations.
163
218
 
164
- If the gateway successfully finishes a request but the response body is too large to replay from the idempotency cache, later calls with the same `idempotencyKey` return `idempotency_replay_unavailable` without running or charging the inference again.
219
+ For replay-safe operations, if the gateway successfully finishes a request but the response body is too large to replay from the idempotency cache, later calls with the same `idempotencyKey` return `idempotency_replay_unavailable` without running or charging the inference again.
165
220
 
166
221
  `timeoutMs` must be positive, `maxRetries` must be a non-negative integer, and `retryBaseMs` must be non-negative. Unknown per-request option keys are rejected so typos do not silently disable idempotency, tracing, timeout, or retry behavior. Invalid values throw `RunInfraError` with `type: "invalid_request_options"` before any network request is sent.
167
222
 
168
223
  ## Request validation
169
224
 
170
- Required request fields are validated before any network request is sent. The model must be a non-blank string, chat messages must be a non-empty array, each chat message must be an object with a non-empty role, Responses input must be a non-empty string or array, Responses input array items must be objects, JSON request bodies must be serializable and contain only finite numbers, embedding input must be a non-empty string or array of non-empty strings, TTS input and image prompts must be non-empty strings, and ASR file must be a Blob. ASR multipart filenames and extra form field names and values are validated before the FormData body is built. Invalid request values throw `RunInfraError` with `type: "invalid_request_options"` and do not reach the gateway or billing path.
225
+ Required request fields are validated before any network request is sent. The model must be a non-blank string, chat messages must be a non-empty array, each chat message must be an object with a non-empty role, Responses input must be a non-empty string or array, Responses input array items must be objects, JSON request bodies must be serializable and contain only finite numbers, embedding input must be a non-empty string or array of non-empty strings, TTS input and image prompts must be non-empty strings, and ASR file must be a non-empty Blob. ASR multipart filenames are validated before the FormData body is built. Invalid request values throw `RunInfraError` with `type: "invalid_request_options"` and do not reach the gateway or billing path.
171
226
 
172
227
  Use per-request options when a call needs a shorter timeout, a trace ID, or a retry-safe idempotency key.
228
+ TypeScript request interfaces are closed around typed fields, and unknown direct request fields are rejected before any network request is sent. Use `extraBody` in request options for deliberate JSON body extensions, such as an unsupported-parameter probe. `extraBody` is only accepted on JSON body requests. `extraBody` cannot override typed request fields and is validated before the request is sent.
173
229
  Custom headers are for app metadata only. They cannot override SDK-controlled headers such as `Authorization`, `Content-Type`, `X-Client-Request-Id`, `Idempotency-Key`, `X-RunInfra-SDK`, or `X-RunInfra-SDK-Version`, and they cannot set transport or credential headers such as `Host`, `Cookie`, `Content-Length`, `Transfer-Encoding`, `Connection`, `Proxy-Authorization`, `Api-Key`, `X-API-Key`, `X-Auth-Token`, or `X-Access-Token`.
174
230
 
175
231
  ```ts
@@ -189,8 +245,10 @@ await client.responses.create(
189
245
 
190
246
  ## Typed errors
191
247
 
192
- The SDK exposes `AuthenticationError`, `PermissionDeniedError`, `RateLimitError`, `InsufficientCreditsError`, `DeploymentError`, `ModelNotFoundError`, `RunInfraTimeoutError`, `RunInfraConnectionError`, `RunInfraStreamParseError`, and `UnsupportedOperationError`.
248
+ The SDK exposes `AuthenticationError`, `PermissionDeniedError`, `RateLimitError`, `InsufficientCreditsError`, `DeploymentError`, `ModelNotFoundError`, `RunInfraTimeoutError`, `RunInfraConnectionError`, and `RunInfraStreamParseError`. `UnsupportedOperationError` remains exported for compatibility with older v0.1.x code, but current public helpers do not raise it.
193
249
  `RateLimitError` includes `retryAfterMs` when the gateway returns `Retry-After`.
250
+ `PermissionDeniedError.type` preserves a specific gateway discriminator on `403` responses when one is present (for example `byoc_plan_required` when a workspace below the deploy tier calls a BYOC-deployed endpoint); it falls back to `permission_denied`. Branch on `err.type` instead of matching the message string.
251
+ `InsufficientCreditsError` includes `currentBalanceCents`, `requiredCents`, and `topupUrl` when the gateway returns them on a `402` response, so you can render an exact top-up prompt without parsing the message.
194
252
  `RunInfraStreamParseError` includes `requestId` when a malformed SSE frame came from a traced gateway response.
195
253
  `RunInfraTimeoutError` also covers stalled streaming reads, stalled non-streaming JSON body reads, and stalled binary audio `arrayBuffer()` / `blob()` reads after headers arrive, and includes `requestId` when the response was traced.
196
254
  `RunInfraConnectionError` also covers streaming body transport failures, non-streaming JSON body transport failures, and binary audio `arrayBuffer()` / `blob()` transport failures after headers arrive, and includes `requestId` when the response was traced.
@@ -206,11 +264,11 @@ Every request includes `X-RunInfra-SDK: typescript`, `X-RunInfra-SDK-Version`, a
206
264
 
207
265
  When `idempotencyKey` is provided, the SDK sends it as `Idempotency-Key`. Use a unique value for each logical retry-safe operation. Idempotency keys must be non-blank, ASCII, 255 characters or less, and must not contain secrets or personal data.
208
266
 
209
- Successful JSON object responses include `_request_id` when the gateway returns `x-request-id`. Streaming responses expose the same value as `stream.requestId`, malformed stream frames raise `RunInfraStreamParseError` with that request id, and binary audio responses expose it as `response.requestId`. Log that value with production errors and customer support reports.
267
+ Successful JSON object responses include `_request_id` when the gateway returns `x-request-id`. Streaming responses expose the same value as `stream.requestId`, malformed stream frames raise `RunInfraStreamParseError` with that request id, and binary audio responses expose it as `response.requestId`. Gateway errors expose `requestId`, `type`, and, when returned by the API, OpenAI-style `code` and `param` metadata such as `unsupported_parameter` and `dimensions`. Log the request id with production errors and customer support reports.
210
268
 
211
269
  ## Webhook verification
212
270
 
213
- Public webhook delivery routes are not shipped yet, but the SDK includes local verification helpers for signed RunInfra webhook deliveries once you receive them in your own server. Always verify the exact raw body before parsing JSON. The `RunInfra-Signature` timestamp must be a non-negative integer Unix second.
271
+ Webhook delivery management is outside the public SDK surface. The SDK includes local verification helpers for signed RunInfra webhook deliveries once you receive them in your own server. Always verify the exact raw body before parsing JSON. The `RunInfra-Signature` timestamp must be a non-negative integer Unix second.
214
272
 
215
273
  ```ts
216
274
  import {
@@ -247,48 +305,12 @@ const client = new OpenAI({
247
305
  });
248
306
  ```
249
307
 
250
- ## Production promotion
251
-
252
- Local package tests prove SDK shape, retry behavior, streaming parsing, typed
253
- errors, package contents, version sync, and trusted-publishing workflow policy.
254
- They do not prove that a newly optimized deployment is ready for customers.
255
- This extracted public repo does not define the old monorepo live-canary
256
- commands.
257
-
258
- For production promotion from this repo, run these local checks from the
259
- repository root before opening a release PR:
260
-
261
- ```bash
262
- node scripts/verify-workflow-policy.mjs
263
- node scripts/verify-version-sync.mjs
264
- pnpm --dir typescript install --lockfile=false
265
- pnpm --dir typescript exec tsc -p tsconfig.json --noEmit
266
- pnpm --dir typescript test
267
- pnpm --dir typescript build
268
- pnpm --dir typescript pack
269
- node scripts/verify-npm-package.mjs typescript/runinfra-sdk-*.tgz
270
- python -m pip install -e python pytest build twine
271
- python -m pytest python/tests -v
272
- python -m build python
273
- python scripts/verify-python-package.py python/dist
274
- python -m twine check python/dist/*
275
- ```
276
-
277
- Then trigger a GitHub dry-run publish from `main`:
278
-
279
- ```bash
280
- gh workflow run publish.yml --repo RightNow-AI/runinfra-sdk --ref main -f package=both -f dry_run=true
281
- ```
282
-
283
- Actual publishing must use the same workflow with `dry_run=false` after CI,
284
- review, and environment approval. Do not use npm or PyPI tokens. OIDC trusted
285
- publishing is the only supported publish path.
308
+ ## Voice pipelines and webhooks
286
309
 
287
- Run live deployment canaries from RunPipe or RunInfra-Engine against the exact
288
- production gateway, workspace, pipeline keys, and RunPod inventory that will
289
- serve customers. The SDK repo only proves client artifact integrity. GA still
290
- requires live coverage for LLM, embeddings, image, TTS, ASR, and voice pipeline
291
- surfaces, plus explicit evidence that the smoke keys and temporary canary
292
- resources were removed.
310
+ Co-located voice pipelines are available through the native
311
+ `client.voice.pipeline.create()` helper on pipeline-scoped keys. The helper
312
+ posts binary audio to the pipeline-scoped `/pipeline` route and returns the JSON
313
+ transcript / response envelope.
293
314
 
294
- Co-located voice pipelines are available through the native `client.voice.pipeline.create()` helper on pipeline-scoped keys. The helper posts binary audio to the pipeline-scoped `/pipeline` route and returns the JSON transcript / response envelope. Public webhook create/list calls are intentionally unavailable until their gateway routes are verified, and the SDK throws `UnsupportedOperationError` locally for those webhook capabilities without making a request.
315
+ Webhook delivery management is handled outside the public SDK surface. Local
316
+ signature verification helpers are available now.