190proof 1.0.120 → 1.0.122
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/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -206,6 +206,17 @@ interface ParsedResponseMessage {
|
|
|
206
206
|
* when the provider reports none.
|
|
207
207
|
*/
|
|
208
208
|
thoughts_tokens?: number;
|
|
209
|
+
/**
|
|
210
|
+
* Prompt tokens written to the provider's cache (subset of prompt_tokens).
|
|
211
|
+
* Billed above the plain input rate on Anthropic (1.25x 5m, 2x 1h).
|
|
212
|
+
* Currently populated from Anthropic's `cache_creation_input_tokens`.
|
|
213
|
+
*/
|
|
214
|
+
cache_write_tokens?: number;
|
|
215
|
+
/**
|
|
216
|
+
* USD actually billed for this call, as reported by the provider.
|
|
217
|
+
* Currently populated from OpenRouter's `usage.cost`; undefined elsewhere.
|
|
218
|
+
*/
|
|
219
|
+
cost?: number;
|
|
209
220
|
} | null;
|
|
210
221
|
}
|
|
211
222
|
interface FunctionCall {
|
package/dist/index.d.ts
CHANGED
|
@@ -206,6 +206,17 @@ interface ParsedResponseMessage {
|
|
|
206
206
|
* when the provider reports none.
|
|
207
207
|
*/
|
|
208
208
|
thoughts_tokens?: number;
|
|
209
|
+
/**
|
|
210
|
+
* Prompt tokens written to the provider's cache (subset of prompt_tokens).
|
|
211
|
+
* Billed above the plain input rate on Anthropic (1.25x 5m, 2x 1h).
|
|
212
|
+
* Currently populated from Anthropic's `cache_creation_input_tokens`.
|
|
213
|
+
*/
|
|
214
|
+
cache_write_tokens?: number;
|
|
215
|
+
/**
|
|
216
|
+
* USD actually billed for this call, as reported by the provider.
|
|
217
|
+
* Currently populated from OpenRouter's `usage.cost`; undefined elsewhere.
|
|
218
|
+
*/
|
|
219
|
+
cost?: number;
|
|
209
220
|
} | null;
|
|
210
221
|
}
|
|
211
222
|
interface FunctionCall {
|
package/dist/index.js
CHANGED
|
@@ -928,7 +928,8 @@ ${text}` : text;
|
|
|
928
928
|
prompt_tokens: promptTokens,
|
|
929
929
|
completion_tokens: data.usage.output_tokens,
|
|
930
930
|
total_tokens: promptTokens + data.usage.output_tokens,
|
|
931
|
-
cached_tokens: cacheRead
|
|
931
|
+
cached_tokens: cacheRead,
|
|
932
|
+
cache_write_tokens: cacheWrite
|
|
932
933
|
};
|
|
933
934
|
}
|
|
934
935
|
return {
|
|
@@ -1538,7 +1539,8 @@ function finalizeOpenRouterMessage(id, raw) {
|
|
|
1538
1539
|
prompt_tokens: raw.usage.prompt_tokens,
|
|
1539
1540
|
completion_tokens: raw.usage.completion_tokens,
|
|
1540
1541
|
total_tokens: raw.usage.total_tokens,
|
|
1541
|
-
cached_tokens: (_e = (_d = raw.usage.prompt_tokens_details) == null ? void 0 : _d.cached_tokens) != null ? _e : 0
|
|
1542
|
+
cached_tokens: (_e = (_d = raw.usage.prompt_tokens_details) == null ? void 0 : _d.cached_tokens) != null ? _e : 0,
|
|
1543
|
+
cost: typeof raw.usage.cost === "number" ? raw.usage.cost : void 0
|
|
1542
1544
|
} : null
|
|
1543
1545
|
};
|
|
1544
1546
|
}
|
|
@@ -1818,7 +1820,7 @@ async function callOpenRouterNonStreaming(id, payload, requestTimeoutMs = OPENRO
|
|
|
1818
1820
|
"OpenRouter",
|
|
1819
1821
|
requestTimeoutMs,
|
|
1820
1822
|
signal,
|
|
1821
|
-
(mergedSignal) => import_axios.default.post(openRouterEndpoint(), payload, {
|
|
1823
|
+
(mergedSignal) => import_axios.default.post(openRouterEndpoint(), { ...payload, usage: { include: true } }, {
|
|
1822
1824
|
headers: {
|
|
1823
1825
|
"content-type": "application/json",
|
|
1824
1826
|
Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}`
|