@pdfvector/util 0.3.1 → 0.4.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/.tsc/lib/contract/gateway/router/admin/usage/index.d.ts +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/index.d.ts.map +1 -1
- package/.tsc/lib/contract/gateway/router/admin/usage/index.js +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/provider-costs.d.ts +39 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/provider-costs.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/provider-costs.js +23 -0
- package/CHANGELOG.md +9 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
/** Estimated provider cost (OCR, LLM, academic APIs, proxy) for the admin dashboard. */
|
|
3
|
+
export declare const getProviderCosts: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
4
|
+
period: z.ZodDefault<z.ZodEnum<{
|
|
5
|
+
"30d": "30d";
|
|
6
|
+
"7d": "7d";
|
|
7
|
+
"90d": "90d";
|
|
8
|
+
all: "all";
|
|
9
|
+
}>>;
|
|
10
|
+
instanceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
11
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
12
|
+
api: "api";
|
|
13
|
+
internal: "internal";
|
|
14
|
+
make: "make";
|
|
15
|
+
mcp: "mcp";
|
|
16
|
+
n8n: "n8n";
|
|
17
|
+
playground: "playground";
|
|
18
|
+
sdk: "sdk";
|
|
19
|
+
unknown: "unknown";
|
|
20
|
+
zapier: "zapier";
|
|
21
|
+
}>>>;
|
|
22
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
23
|
+
totalCostUsdMicro: z.ZodNumber;
|
|
24
|
+
byProvider: z.ZodArray<z.ZodObject<{
|
|
25
|
+
calls: z.ZodNumber;
|
|
26
|
+
failedCalls: z.ZodNumber;
|
|
27
|
+
costUsdMicro: z.ZodNumber;
|
|
28
|
+
provider: z.ZodString;
|
|
29
|
+
service: z.ZodString;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
byOperationTier: z.ZodArray<z.ZodObject<{
|
|
32
|
+
calls: z.ZodNumber;
|
|
33
|
+
failedCalls: z.ZodNumber;
|
|
34
|
+
costUsdMicro: z.ZodNumber;
|
|
35
|
+
operation: z.ZodString;
|
|
36
|
+
tier: z.ZodString;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
39
|
+
//# sourceMappingURL=provider-costs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-costs.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/provider-costs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAQzB,wFAAwF;AACxF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAqB3B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { apiSources } from "@pdfvector/util";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
const costRowSchema = z.object({
|
|
5
|
+
calls: z.number(),
|
|
6
|
+
failedCalls: z.number(),
|
|
7
|
+
costUsdMicro: z.number(),
|
|
8
|
+
});
|
|
9
|
+
/** Estimated provider cost (OCR, LLM, academic APIs, proxy) for the admin dashboard. */
|
|
10
|
+
export const getProviderCosts = oc
|
|
11
|
+
.input(z.object({
|
|
12
|
+
period: z.enum(["7d", "30d", "90d", "all"]).default("30d"),
|
|
13
|
+
instanceId: z.number().nullable().optional(),
|
|
14
|
+
sources: z.array(z.enum(apiSources)).optional(),
|
|
15
|
+
}))
|
|
16
|
+
.output(z.object({
|
|
17
|
+
totalCostUsdMicro: z.number(),
|
|
18
|
+
byProvider: z.array(costRowSchema.extend({ provider: z.string(), service: z.string() })),
|
|
19
|
+
byOperationTier: z.array(costRowSchema.extend({
|
|
20
|
+
operation: z.string(),
|
|
21
|
+
tier: z.string(),
|
|
22
|
+
})),
|
|
23
|
+
}));
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @pdfvector/util
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#500](https://github.com/phuctm97/pdfvector/pull/500) [`a9d1140`](https://github.com/phuctm97/pdfvector/commit/a9d1140c701fe3ccb599d49ccf3459ab17e519cd) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Provider cost tracking:
|
|
8
|
+
- LLM calls (Azure OpenAI, Bedrock) now record an estimated cost from a versioned list-price table (`2026-11-list-price`), per deployment type and region, including cached input and cache writes.
|
|
9
|
+
- Academic providers are tracked: Scrapingdog (Google Scholar, 5 credits per call), the Webshare proxy (bandwidth), and Crossref Plus and Semantic Scholar (call volume at $0).
|
|
10
|
+
- A new admin endpoint `getProviderCosts` and a "Provider cost" card on the admin usage overview show cost per provider and per API + tier.
|
|
11
|
+
|
|
3
12
|
## 0.3.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|