190proof 1.0.115 → 1.0.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/dist/index.d.mts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +178 -161
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +175 -160
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,6 +136,16 @@ const payload: GenericPayload = {
|
|
|
136
136
|
const response = await callWithRetries("image-example", payload);
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
+
How images reach the model depends on the provider. OpenAI, Anthropic, and
|
|
140
|
+
Google get native image blocks. Groq is text-only: images degrade to an inline
|
|
141
|
+
`Image (url)` text reference. OpenRouter sends OpenAI-style `image_url` content
|
|
142
|
+
parts (the remote URL when present, else a `data:` URI) — but if the model has
|
|
143
|
+
no vision-capable endpoints, OpenRouter rejects the request with a
|
|
144
|
+
routing-layer 404, so the retry loop resends the payload with images degraded
|
|
145
|
+
to the same inline text references Groq gets, and remembers the model
|
|
146
|
+
(in-process, until restart) so later calls degrade up front. Messages without
|
|
147
|
+
image attachments serialize identically either way.
|
|
148
|
+
|
|
139
149
|
### With System Messages
|
|
140
150
|
|
|
141
151
|
```typescript
|
|
@@ -280,7 +290,7 @@ Optional per-request knobs live on `payload` (`GenericPayload`):
|
|
|
280
290
|
- `payload.streamTimeoutMs`: `number` - OpenRouter-only: total wall-clock budget per streaming attempt (default: 600000).
|
|
281
291
|
- `payload.streamDeadlineAt`: `number` - OpenRouter-only: absolute deadline (epoch ms) for the whole call **including retries** — the caller's turn budget. Each attempt gets `min(streamTimeoutMs, deadline - now)`, and once under 10s remain the call fails fast instead of starting a generation that cannot be delivered. Use it whenever the caller has its own timeout: a per-attempt budget alone is re-granted on every retry and can outlive that timeout.
|
|
282
292
|
- `payload.thinkingConfig`: `Record<string, unknown>` - Google-only: forwarded verbatim as `generationConfig.thinkingConfig` on the Gemini request — e.g. `{ thinkingBudget: 0 }` to disable thinking, `{ thinkingLevel: "HIGH" }` on models that take a level. Ignored by all other adapters; shapes are model-specific and validated by Google, not the SDK.
|
|
283
|
-
- `payload.reasoningEffort`: `string` - OpenAI
|
|
293
|
+
- `payload.reasoningEffort`: `string` - OpenAI and OpenRouter: forwarded as `reasoning_effort` on the request. Valid values are model-dependent (`none`/`minimal`/`low`/`medium`/`high`/`xhigh`/`max`). Direct OpenAI: reasoning-by-default models (the gpt-5.6 family) reject function tools on `/chat/completions` with a 400 unless this is explicitly `"none"` — their implicit default is `medium`. Via OpenRouter the same models accept tools at any effort (OpenRouter fronts `/v1/responses`), so omitting this runs them at their native default. Ignored by all other adapters.
|
|
284
294
|
|
|
285
295
|
When a streaming attempt is cut at its **total deadline** and prose has already arrived, the partial answer is returned with `truncated: true` on the response rather than discarded — those tokens were generated and billed, so throwing them away costs money and gives the user nothing. Surface such a reply as incomplete. Salvage never applies to tool-call turns (half-streamed arguments are unparseable JSON), to stalls (the provider died mid-thought), or to caller aborts. When nothing is salvageable, the discard is logged with an approximate token count — aborted attempts never receive OpenRouter's `usage` chunk, so that log line is the only record of the wasted spend.
|
|
286
296
|
|
package/dist/index.d.mts
CHANGED
|
@@ -296,11 +296,15 @@ interface GenericPayload {
|
|
|
296
296
|
*/
|
|
297
297
|
provider?: OpenRouterProviderPreferences;
|
|
298
298
|
/**
|
|
299
|
-
* OpenAI
|
|
300
|
-
* are model-dependent
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
299
|
+
* OpenAI and OpenRouter: forwarded as `reasoning_effort` on the request.
|
|
300
|
+
* Valid values are model-dependent
|
|
301
|
+
* (`none`/`minimal`/`low`/`medium`/`high`/`xhigh`/`max`).
|
|
302
|
+
* Direct OpenAI: reasoning-by-default models (gpt-5.6 family) 400 on
|
|
303
|
+
* /chat/completions when function tools are present unless this is
|
|
304
|
+
* explicitly `"none"` — their implicit default is `medium`. Via OpenRouter
|
|
305
|
+
* the same models accept tools at any effort (OpenRouter fronts
|
|
306
|
+
* /v1/responses), so omitting this runs them at their native default.
|
|
307
|
+
* Ignored by all other adapters.
|
|
304
308
|
*/
|
|
305
309
|
reasoningEffort?: string;
|
|
306
310
|
/**
|
|
@@ -352,6 +356,15 @@ interface GenericPayload {
|
|
|
352
356
|
signal?: AbortSignal;
|
|
353
357
|
}
|
|
354
358
|
|
|
359
|
+
/**
|
|
360
|
+
* In-process memory of OpenRouter models that rejected image input (the
|
|
361
|
+
* routing-layer 404 "No endpoints found that support image input"). Payloads
|
|
362
|
+
* for these models degrade image attachments to inline `Image (url)` text
|
|
363
|
+
* references up front — the exact pre-vision serialization — instead of
|
|
364
|
+
* burning a doomed attempt per call. Populated by the retry loop on first
|
|
365
|
+
* rejection; cleared only by process restart (exported so tests can reset it).
|
|
366
|
+
*/
|
|
367
|
+
declare const openRouterImageRejectedModels: Set<string>;
|
|
355
368
|
declare const OPENROUTER_STREAM_TIMEOUT_MS = 600000;
|
|
356
369
|
declare const OPENROUTER_NONSTREAM_TIMEOUT_MS = 180000;
|
|
357
370
|
/**
|
|
@@ -366,4 +379,4 @@ declare function parseModelString(model: string): {
|
|
|
366
379
|
};
|
|
367
380
|
declare function callWithRetries(id: string | string[], aiPayload: GenericPayload, aiConfig?: OpenAIConfig | AnthropicAIConfig, retries?: number, chunkTimeoutMs?: number): Promise<ParsedResponseMessage>;
|
|
368
381
|
|
|
369
|
-
export { type AnyModel, ClaudeModel, type FunctionCall, type FunctionDefinition, GPTModel, GeminiModel, type GenericMessage, type GenericPayload, GroqModel, MIN_STREAM_ATTEMPT_MS, OPENROUTER_NONSTREAM_TIMEOUT_MS, OPENROUTER_STREAM_TIMEOUT_MS, type OpenAIConfig, OpenRouterModel, type OpenRouterProviderPreferences, type ParsedResponseMessage, type Provider, type ToolResult, callWithRetries, parseModelString };
|
|
382
|
+
export { type AnyModel, ClaudeModel, type FunctionCall, type FunctionDefinition, GPTModel, GeminiModel, type GenericMessage, type GenericPayload, GroqModel, MIN_STREAM_ATTEMPT_MS, OPENROUTER_NONSTREAM_TIMEOUT_MS, OPENROUTER_STREAM_TIMEOUT_MS, type OpenAIConfig, OpenRouterModel, type OpenRouterProviderPreferences, type ParsedResponseMessage, type Provider, type ToolResult, callWithRetries, openRouterImageRejectedModels, parseModelString };
|
package/dist/index.d.ts
CHANGED
|
@@ -296,11 +296,15 @@ interface GenericPayload {
|
|
|
296
296
|
*/
|
|
297
297
|
provider?: OpenRouterProviderPreferences;
|
|
298
298
|
/**
|
|
299
|
-
* OpenAI
|
|
300
|
-
* are model-dependent
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
299
|
+
* OpenAI and OpenRouter: forwarded as `reasoning_effort` on the request.
|
|
300
|
+
* Valid values are model-dependent
|
|
301
|
+
* (`none`/`minimal`/`low`/`medium`/`high`/`xhigh`/`max`).
|
|
302
|
+
* Direct OpenAI: reasoning-by-default models (gpt-5.6 family) 400 on
|
|
303
|
+
* /chat/completions when function tools are present unless this is
|
|
304
|
+
* explicitly `"none"` — their implicit default is `medium`. Via OpenRouter
|
|
305
|
+
* the same models accept tools at any effort (OpenRouter fronts
|
|
306
|
+
* /v1/responses), so omitting this runs them at their native default.
|
|
307
|
+
* Ignored by all other adapters.
|
|
304
308
|
*/
|
|
305
309
|
reasoningEffort?: string;
|
|
306
310
|
/**
|
|
@@ -352,6 +356,15 @@ interface GenericPayload {
|
|
|
352
356
|
signal?: AbortSignal;
|
|
353
357
|
}
|
|
354
358
|
|
|
359
|
+
/**
|
|
360
|
+
* In-process memory of OpenRouter models that rejected image input (the
|
|
361
|
+
* routing-layer 404 "No endpoints found that support image input"). Payloads
|
|
362
|
+
* for these models degrade image attachments to inline `Image (url)` text
|
|
363
|
+
* references up front — the exact pre-vision serialization — instead of
|
|
364
|
+
* burning a doomed attempt per call. Populated by the retry loop on first
|
|
365
|
+
* rejection; cleared only by process restart (exported so tests can reset it).
|
|
366
|
+
*/
|
|
367
|
+
declare const openRouterImageRejectedModels: Set<string>;
|
|
355
368
|
declare const OPENROUTER_STREAM_TIMEOUT_MS = 600000;
|
|
356
369
|
declare const OPENROUTER_NONSTREAM_TIMEOUT_MS = 180000;
|
|
357
370
|
/**
|
|
@@ -366,4 +379,4 @@ declare function parseModelString(model: string): {
|
|
|
366
379
|
};
|
|
367
380
|
declare function callWithRetries(id: string | string[], aiPayload: GenericPayload, aiConfig?: OpenAIConfig | AnthropicAIConfig, retries?: number, chunkTimeoutMs?: number): Promise<ParsedResponseMessage>;
|
|
368
381
|
|
|
369
|
-
export { type AnyModel, ClaudeModel, type FunctionCall, type FunctionDefinition, GPTModel, GeminiModel, type GenericMessage, type GenericPayload, GroqModel, MIN_STREAM_ATTEMPT_MS, OPENROUTER_NONSTREAM_TIMEOUT_MS, OPENROUTER_STREAM_TIMEOUT_MS, type OpenAIConfig, OpenRouterModel, type OpenRouterProviderPreferences, type ParsedResponseMessage, type Provider, type ToolResult, callWithRetries, parseModelString };
|
|
382
|
+
export { type AnyModel, ClaudeModel, type FunctionCall, type FunctionDefinition, GPTModel, GeminiModel, type GenericMessage, type GenericPayload, GroqModel, MIN_STREAM_ATTEMPT_MS, OPENROUTER_NONSTREAM_TIMEOUT_MS, OPENROUTER_STREAM_TIMEOUT_MS, type OpenAIConfig, OpenRouterModel, type OpenRouterProviderPreferences, type ParsedResponseMessage, type Provider, type ToolResult, callWithRetries, openRouterImageRejectedModels, parseModelString };
|