metergraph 0.6.19 → 0.6.20
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 +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrap.d.ts +1 -1
- package/dist/wrap.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -305,3 +305,5 @@ Calls record `service_tier` separately from `requested_service_tier`: requesting
|
|
|
305
305
|
Interrupted Anthropic streams retain available input/cache usage and message IDs, plus `http_request_id` when the SDK exposes it. `usage_complete: false` marks observed usage as incomplete; it does not establish the final charge or mean the request was free.
|
|
306
306
|
|
|
307
307
|
Search usage is retained independently of text capture: OpenAI search-call counts, Anthropic server-tool usage, and Google grounding-query counts. Perplexity Responses capture uses invocation counters, with search-result items as a fallback. Clients using `https://api.perplexity.ai` are detected automatically; use `wrap(client, { provider: "perplexity" })` when a gateway hides the provider. Perplexity Agent and legacy Sonar calls are identified separately. Agent search type is recorded when explicitly set on the tool; missing evidence remains unknown. Prices are resolved by the receiver.
|
|
308
|
+
|
|
309
|
+
For other OpenAI-compatible clients, pass the actual provider name to `wrap()` (for example, `provider="deepseek"` in Python or `{ provider: "deepseek" }` in TypeScript). Capture uses the OpenAI-compatible methods while preserving that provider identity; no provider SDK dependency or routing change is added.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { route, setDefaultTags, setSession, setUser, setTags, trace, withContext
|
|
|
2
2
|
import { BatchFirstIneligibleError, batchFirst, type BatchFirstMetadata, type BatchFirstPolicy, type BatchFirstProvider, type BatchFirstRequest, type BatchFirstResult, type BatchFirstSource, type LateBatchInfo } from "./batch-first.js";
|
|
3
3
|
import { track } from "./track.js";
|
|
4
4
|
import { type TransportMode, type WaitUntil } from "./transport.js";
|
|
5
|
-
import { type WrapOptions } from "./wrap.js";
|
|
5
|
+
import { type WrapOptions, type ProviderName } from "./wrap.js";
|
|
6
6
|
import { type VercelAISDKMiddleware, type VercelAISDKMiddlewareOptions as VercelAISDKCompatibilityOptions, type VercelAISDKMiddlewareSpecificationOptions, type VercelAISDKMiddlewareVersionOptions, type VercelAISDKSpecificationVersion } from "./vercel-ai.js";
|
|
7
7
|
export interface MetergraphOptions {
|
|
8
8
|
token?: string;
|
|
@@ -57,7 +57,7 @@ export declare function wrapHandler<TArgs extends unknown[], TResult>(handler: (
|
|
|
57
57
|
* OpenAI-compatible clients pointed at OpenRouter are detected automatically;
|
|
58
58
|
* pass `{ gateway: "openrouter" }` to force it for a trusted custom domain.
|
|
59
59
|
*/
|
|
60
|
-
export declare function wrap<T extends Record<PropertyKey, any>>(client: T, provider?:
|
|
60
|
+
export declare function wrap<T extends Record<PropertyKey, any>>(client: T, provider?: ProviderName): T;
|
|
61
61
|
export declare function wrap<T extends Record<PropertyKey, any>>(client: T, options: WrapOptions): T;
|
|
62
62
|
export declare const wrapClient: typeof wrap;
|
|
63
63
|
/**
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.6.
|
|
1
|
+
export declare const SDK_VERSION = "0.6.20";
|
package/dist/version.js
CHANGED
package/dist/wrap.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const OPENAI_SEAMS: Seam[];
|
|
|
14
14
|
export declare const ANTHROPIC_SEAMS: Seam[];
|
|
15
15
|
export declare const GOOGLE_SEAMS: Seam[];
|
|
16
16
|
export declare const SEAM_TABLES: Record<string, Seam[]>;
|
|
17
|
-
export type ProviderName = "openai" | "anthropic" | "google" | "perplexity";
|
|
17
|
+
export type ProviderName = "openai" | "anthropic" | "google" | "perplexity" | (string & {});
|
|
18
18
|
export type WrapOptions = {
|
|
19
19
|
provider?: ProviderName;
|
|
20
20
|
gateway?: never;
|
package/dist/wrap.js
CHANGED
|
@@ -740,7 +740,7 @@ function resolveSeam(client, path) {
|
|
|
740
740
|
}
|
|
741
741
|
function applySeams(client, provider, gatewayName) {
|
|
742
742
|
const patched = [];
|
|
743
|
-
for (const seam of exports.SEAM_TABLES[provider
|
|
743
|
+
for (const seam of exports.SEAM_TABLES[provider] ?? exports.SEAM_TABLES.openai ?? []) {
|
|
744
744
|
let owner;
|
|
745
745
|
try {
|
|
746
746
|
owner = resolveSeam(client, seam.path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metergraph",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.20",
|
|
4
4
|
"description": "Zero-dependency TypeScript SDK for function-level LLM cost attribution across major LLM providers and frameworks, including OpenAI, Anthropic, Gemini, and Vercel AI SDK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|