@pdfvector/instance-contract 0.0.31 → 0.0.33

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.
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  export declare const pdfvectorModelSchema: z.ZodEnum<{
3
+ pro: "pro";
3
4
  nano: "nano";
4
5
  mini: "mini";
5
- pro: "pro";
6
6
  max: "max";
7
7
  }>;
@@ -2,13 +2,13 @@ import { z } from "zod";
2
2
  export declare const fetch: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3
3
  ids: z.ZodArray<z.ZodString>;
4
4
  fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
5
+ year: "year";
5
6
  url: "url";
6
7
  doi: "doi";
7
8
  title: "title";
8
9
  providerURL: "providerURL";
9
10
  date: "date";
10
11
  authors: "authors";
11
- year: "year";
12
12
  totalCitations: "totalCitations";
13
13
  totalReferences: "totalReferences";
14
14
  abstract: "abstract";
@@ -1,4 +1,5 @@
1
1
  import { oc } from "@orpc/contract";
2
+ import { academicCreditCosts } from "@pdfvector/util";
2
3
  import { z } from "zod";
3
4
  const authorSchema = z.object({
4
5
  name: z.string(),
@@ -101,7 +102,7 @@ export const fetch = oc
101
102
  }))
102
103
  .route({
103
104
  summary: "Fetch academic papers by ID",
104
- description: "Fetch specific academic publications by their unique identifiers with automatic provider detection and batch processing.",
105
+ description: `Fetch specific academic publications by their unique identifiers with automatic provider detection and batch processing. Costs ${academicCreditCosts.academicFetch} credits per request.`,
105
106
  tags: ["Academic"],
106
107
  spec: (op) => {
107
108
  op.security = [{ bearerAuth: [] }];
@@ -12,13 +12,13 @@ export declare const findCitations: import("@orpc/contract").ContractProcedureBu
12
12
  crossref: "crossref";
13
13
  }>>>;
14
14
  fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
15
+ year: "year";
15
16
  url: "url";
16
17
  doi: "doi";
17
18
  title: "title";
18
19
  providerURL: "providerURL";
19
20
  date: "date";
20
21
  authors: "authors";
21
- year: "year";
22
22
  totalCitations: "totalCitations";
23
23
  totalReferences: "totalReferences";
24
24
  abstract: "abstract";
@@ -1,4 +1,5 @@
1
1
  import { oc } from "@orpc/contract";
2
+ import { academicCreditCosts } from "@pdfvector/util";
2
3
  import { z } from "zod";
3
4
  const providerSchema = z.enum([
4
5
  "semantic-scholar",
@@ -109,7 +110,7 @@ export const findCitations = oc
109
110
  }))
110
111
  .route({
111
112
  summary: "Find citations for a paragraph",
112
- description: "Find relevant academic citations for a paragraph by splitting it into sentences and scoring papers using semantic embedding similarity.",
113
+ description: `Find relevant academic citations for a paragraph by splitting it into sentences and scoring papers using semantic embedding similarity. Costs ${academicCreditCosts.academicFindCitationsPerSentence} credits per sentence.`,
113
114
  tags: ["Academic"],
114
115
  spec: (op) => {
115
116
  op.security = [{ bearerAuth: [] }];
@@ -6,13 +6,13 @@ export declare const paperGraph: import("@orpc/contract").ContractProcedureBuild
6
6
  citationsOffset: z.ZodDefault<z.ZodNumber>;
7
7
  referencesOffset: z.ZodDefault<z.ZodNumber>;
8
8
  fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
9
+ year: "year";
9
10
  url: "url";
10
11
  doi: "doi";
11
12
  title: "title";
12
13
  providerURL: "providerURL";
13
14
  date: "date";
14
15
  authors: "authors";
15
- year: "year";
16
16
  totalCitations: "totalCitations";
17
17
  totalReferences: "totalReferences";
18
18
  abstract: "abstract";
@@ -1,4 +1,5 @@
1
1
  import { oc } from "@orpc/contract";
2
+ import { academicCreditCosts } from "@pdfvector/util";
2
3
  import { z } from "zod";
3
4
  const authorSchema = z.object({
4
5
  name: z.string(),
@@ -125,7 +126,7 @@ export const paperGraph = oc
125
126
  }))
126
127
  .route({
127
128
  summary: "Get paper citations and references",
128
- description: "Fetch a paper's citing papers and referenced papers as full publication objects with automatic provider detection and pagination support.",
129
+ description: `Fetch a paper's citing papers and referenced papers as full publication objects with automatic provider detection and pagination support. Costs ${academicCreditCosts.academicPaperGraphMin}+ credits per request (scales with result count).`,
129
130
  tags: ["Academic"],
130
131
  spec: (op) => {
131
132
  op.security = [{ bearerAuth: [] }];
@@ -1,4 +1,5 @@
1
1
  import { oc } from "@orpc/contract";
2
+ import { academicCreditCosts } from "@pdfvector/util";
2
3
  import { z } from "zod";
3
4
  const grantProviderSchema = z.enum(["grants-gov", "nih-reporter", "cordis", "ukri"], {
4
5
  message: "Invalid provider. Must be one of: grants-gov, nih-reporter, cordis, ukri",
@@ -155,7 +156,7 @@ export const searchGrants = oc
155
156
  }))
156
157
  .route({
157
158
  summary: "Search grants",
158
- description: "Search for research grants and funding opportunities across multiple databases (Grants.gov, NIH RePORTER, CORDIS, UKRI) with unified results, relevance ranking, and filtering by deadline and funding amount.",
159
+ description: `Search for research grants and funding opportunities across multiple databases (Grants.gov, NIH RePORTER, CORDIS, UKRI) with unified results, relevance ranking, and filtering by deadline and funding amount. Costs ${academicCreditCosts.grantSearch} credits per request.`,
159
160
  tags: ["Academic"],
160
161
  spec: (op) => {
161
162
  op.security = [{ bearerAuth: [] }];
@@ -16,13 +16,13 @@ export declare const search: import("@orpc/contract").ContractProcedureBuilderWi
16
16
  yearFrom: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
17
17
  yearTo: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
18
18
  fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
19
+ year: "year";
19
20
  url: "url";
20
21
  doi: "doi";
21
22
  title: "title";
22
23
  providerURL: "providerURL";
23
24
  date: "date";
24
25
  authors: "authors";
25
- year: "year";
26
26
  totalCitations: "totalCitations";
27
27
  totalReferences: "totalReferences";
28
28
  abstract: "abstract";
@@ -1,4 +1,5 @@
1
1
  import { oc } from "@orpc/contract";
2
+ import { academicCreditCosts } from "@pdfvector/util";
2
3
  import { z } from "zod";
3
4
  const providerSchema = z.enum([
4
5
  "semantic-scholar",
@@ -147,7 +148,7 @@ export const search = oc
147
148
  }))
148
149
  .route({
149
150
  summary: "Search academic papers",
150
- description: "Search for academic publications across multiple databases with relevance ranking.",
151
+ description: `Search for academic publications across multiple databases with relevance ranking. Costs ${academicCreditCosts.academicSearch} credits per request.`,
151
152
  tags: ["Academic"],
152
153
  spec: (op) => {
153
154
  op.security = [{ bearerAuth: [] }];
@@ -4,13 +4,13 @@ export declare const similarPapers: import("@orpc/contract").ContractProcedureBu
4
4
  limit: z.ZodDefault<z.ZodNumber>;
5
5
  includeEdges: z.ZodDefault<z.ZodBoolean>;
6
6
  fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
7
+ year: "year";
7
8
  url: "url";
8
9
  doi: "doi";
9
10
  title: "title";
10
11
  providerURL: "providerURL";
11
12
  date: "date";
12
13
  authors: "authors";
13
- year: "year";
14
14
  totalCitations: "totalCitations";
15
15
  totalReferences: "totalReferences";
16
16
  abstract: "abstract";
@@ -1,4 +1,5 @@
1
1
  import { oc } from "@orpc/contract";
2
+ import { academicCreditCosts } from "@pdfvector/util";
2
3
  import { z } from "zod";
3
4
  const authorSchema = z.object({
4
5
  name: z.string(),
@@ -124,7 +125,7 @@ export const similarPapers = oc
124
125
  }))
125
126
  .route({
126
127
  summary: "Find similar papers",
127
- description: "Find papers similar to a seed paper using citation network analysis. Returns papers ranked by similarity with optional graph edge data for visualization.",
128
+ description: `Find papers similar to a seed paper using citation network analysis. Returns papers ranked by similarity with optional graph edge data for visualization. Costs ${academicCreditCosts.academicSimilarPapers} credits per request.`,
128
129
  tags: ["Academic"],
129
130
  spec: (op) => {
130
131
  op.security = [{ bearerAuth: [] }];
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ export declare const getFreeUsageRecords: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3
+ cursor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
4
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
5
+ }, z.core.$strip>, z.ZodObject<{
6
+ records: z.ZodArray<z.ZodObject<{
7
+ id: z.ZodNumber;
8
+ operation: z.ZodString;
9
+ ip: z.ZodString;
10
+ model: z.ZodNullable<z.ZodString>;
11
+ inputSource: z.ZodNullable<z.ZodString>;
12
+ inputRef: z.ZodNullable<z.ZodString>;
13
+ fileSize: z.ZodNullable<z.ZodNumber>;
14
+ documentType: z.ZodNullable<z.ZodString>;
15
+ pageCount: z.ZodNullable<z.ZodNumber>;
16
+ error: z.ZodNullable<z.ZodString>;
17
+ duration: z.ZodNumber;
18
+ createdAt: z.ZodNumber;
19
+ }, z.core.$strip>>;
20
+ hasMore: z.ZodBoolean;
21
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -0,0 +1,34 @@
1
+ import { oc } from "@orpc/contract";
2
+ import { z } from "zod";
3
+ const freeUsageRecordSchema = z.object({
4
+ id: z.number(),
5
+ operation: z.string(),
6
+ ip: z.string(),
7
+ model: z.string().nullable(),
8
+ inputSource: z.string().nullable(),
9
+ inputRef: z.string().nullable(),
10
+ fileSize: z.number().nullable(),
11
+ documentType: z.string().nullable(),
12
+ pageCount: z.number().nullable(),
13
+ error: z.string().nullable(),
14
+ duration: z.number(),
15
+ createdAt: z.number(),
16
+ });
17
+ export const getFreeUsageRecords = oc
18
+ .route({
19
+ summary: "Get free usage records",
20
+ description: "Returns free usage records with id > cursor, ordered by id ascending",
21
+ tags: ["Admin"],
22
+ spec: (op) => {
23
+ op.security = [{ bearerAuth: [] }];
24
+ return op;
25
+ },
26
+ })
27
+ .input(z.object({
28
+ cursor: z.number().optional().default(0),
29
+ limit: z.number().optional().default(1000),
30
+ }))
31
+ .output(z.object({
32
+ records: z.array(freeUsageRecordSchema),
33
+ hasMore: z.boolean(),
34
+ }));
@@ -1,3 +1,4 @@
1
+ export * from "./get-free-usage-records";
1
2
  export * from "./get-usage-records";
2
3
  export * from "./health-check";
3
4
  export * from "./set-domain";
@@ -1,3 +1,4 @@
1
+ export * from "./get-free-usage-records";
1
2
  export * from "./get-usage-records";
2
3
  export * from "./health-check";
3
4
  export * from "./set-domain";
@@ -5,9 +5,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
5
5
  base64: z.ZodOptional<z.ZodString>;
6
6
  question: z.ZodString;
7
7
  model: z.ZodDefault<z.ZodEnum<{
8
+ pro: "pro";
8
9
  nano: "nano";
9
10
  mini: "mini";
10
- pro: "pro";
11
11
  max: "max";
12
12
  auto: "auto";
13
13
  }>>;
@@ -19,9 +19,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
19
19
  markdown: z.ZodString;
20
20
  pageCount: z.ZodNumber;
21
21
  model: z.ZodEnum<{
22
+ pro: "pro";
22
23
  nano: "nano";
23
24
  mini: "mini";
24
- pro: "pro";
25
25
  max: "max";
26
26
  }>;
27
27
  credits: z.ZodNumber;
@@ -6,9 +6,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
6
6
  prompt: z.ZodString;
7
7
  schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<Record<string, unknown>, string>>]>;
8
8
  model: z.ZodDefault<z.ZodEnum<{
9
+ pro: "pro";
9
10
  nano: "nano";
10
11
  mini: "mini";
11
- pro: "pro";
12
12
  max: "max";
13
13
  auto: "auto";
14
14
  }>>;
@@ -20,9 +20,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
20
20
  data: z.ZodUnknown;
21
21
  pageCount: z.ZodNumber;
22
22
  model: z.ZodEnum<{
23
+ pro: "pro";
23
24
  nano: "nano";
24
25
  mini: "mini";
25
- pro: "pro";
26
26
  max: "max";
27
27
  }>;
28
28
  credits: z.ZodNumber;
@@ -5,9 +5,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
5
5
  base64: z.ZodOptional<z.ZodString>;
6
6
  question: z.ZodString;
7
7
  model: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
8
+ pro: "pro";
8
9
  nano: "nano";
9
10
  mini: "mini";
10
- pro: "pro";
11
11
  max: "max";
12
12
  auto: "auto";
13
13
  }>>>;
@@ -19,9 +19,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
19
19
  markdown: z.ZodString;
20
20
  pageCount: z.ZodNumber;
21
21
  model: z.ZodEnum<{
22
+ pro: "pro";
22
23
  nano: "nano";
23
24
  mini: "mini";
24
- pro: "pro";
25
25
  max: "max";
26
26
  }>;
27
27
  credits: z.ZodNumber;
@@ -6,9 +6,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
6
6
  prompt: z.ZodString;
7
7
  schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<Record<string, unknown>, string>>]>;
8
8
  model: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
9
+ pro: "pro";
9
10
  nano: "nano";
10
11
  mini: "mini";
11
- pro: "pro";
12
12
  max: "max";
13
13
  auto: "auto";
14
14
  }>>>;
@@ -20,9 +20,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
20
20
  data: z.ZodUnknown;
21
21
  pageCount: z.ZodNumber;
22
22
  model: z.ZodEnum<{
23
+ pro: "pro";
23
24
  nano: "nano";
24
25
  mini: "mini";
25
- pro: "pro";
26
26
  max: "max";
27
27
  }>;
28
28
  credits: z.ZodNumber;
@@ -4,9 +4,9 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
4
4
  file: z.ZodOptional<z.ZodFile>;
5
5
  base64: z.ZodOptional<z.ZodString>;
6
6
  model: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
7
+ pro: "pro";
7
8
  nano: "nano";
8
9
  mini: "mini";
9
- pro: "pro";
10
10
  max: "max";
11
11
  auto: "auto";
12
12
  }>>>;
@@ -18,9 +18,9 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
18
18
  markdown: z.ZodString;
19
19
  pageCount: z.ZodNumber;
20
20
  model: z.ZodEnum<{
21
+ pro: "pro";
21
22
  nano: "nano";
22
23
  mini: "mini";
23
- pro: "pro";
24
24
  max: "max";
25
25
  }>;
26
26
  credits: z.ZodNumber;
@@ -5,9 +5,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
5
5
  base64: z.ZodOptional<z.ZodString>;
6
6
  question: z.ZodString;
7
7
  model: z.ZodDefault<z.ZodEnum<{
8
+ pro: "pro";
8
9
  nano: "nano";
9
10
  mini: "mini";
10
- pro: "pro";
11
11
  max: "max";
12
12
  auto: "auto";
13
13
  }>>;
@@ -19,9 +19,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
19
19
  markdown: z.ZodString;
20
20
  pageCount: z.ZodNumber;
21
21
  model: z.ZodEnum<{
22
+ pro: "pro";
22
23
  nano: "nano";
23
24
  mini: "mini";
24
- pro: "pro";
25
25
  max: "max";
26
26
  }>;
27
27
  credits: z.ZodNumber;
@@ -6,9 +6,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
6
6
  prompt: z.ZodString;
7
7
  schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<Record<string, unknown>, string>>]>;
8
8
  model: z.ZodDefault<z.ZodEnum<{
9
+ pro: "pro";
9
10
  nano: "nano";
10
11
  mini: "mini";
11
- pro: "pro";
12
12
  max: "max";
13
13
  auto: "auto";
14
14
  }>>;
@@ -20,9 +20,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
20
20
  data: z.ZodUnknown;
21
21
  pageCount: z.ZodNumber;
22
22
  model: z.ZodEnum<{
23
+ pro: "pro";
23
24
  nano: "nano";
24
25
  mini: "mini";
25
- pro: "pro";
26
26
  max: "max";
27
27
  }>;
28
28
  credits: z.ZodNumber;
@@ -5,9 +5,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
5
5
  base64: z.ZodOptional<z.ZodString>;
6
6
  question: z.ZodString;
7
7
  model: z.ZodDefault<z.ZodEnum<{
8
+ pro: "pro";
8
9
  nano: "nano";
9
10
  mini: "mini";
10
- pro: "pro";
11
11
  max: "max";
12
12
  auto: "auto";
13
13
  }>>;
@@ -19,9 +19,9 @@ export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithI
19
19
  markdown: z.ZodString;
20
20
  pageCount: z.ZodNumber;
21
21
  model: z.ZodEnum<{
22
+ pro: "pro";
22
23
  nano: "nano";
23
24
  mini: "mini";
24
- pro: "pro";
25
25
  max: "max";
26
26
  }>;
27
27
  credits: z.ZodNumber;
@@ -6,9 +6,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
6
6
  prompt: z.ZodString;
7
7
  schema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<Record<string, unknown>, string>>]>;
8
8
  model: z.ZodDefault<z.ZodEnum<{
9
+ pro: "pro";
9
10
  nano: "nano";
10
11
  mini: "mini";
11
- pro: "pro";
12
12
  max: "max";
13
13
  auto: "auto";
14
14
  }>>;
@@ -20,9 +20,9 @@ export declare const extract: import("@orpc/contract").ContractProcedureBuilderW
20
20
  data: z.ZodUnknown;
21
21
  pageCount: z.ZodNumber;
22
22
  model: z.ZodEnum<{
23
+ pro: "pro";
23
24
  nano: "nano";
24
25
  mini: "mini";
25
- pro: "pro";
26
26
  max: "max";
27
27
  }>;
28
28
  credits: z.ZodNumber;
@@ -1,3 +1,4 @@
1
+ import { allSupportedFormatsLong, allSupportedFormatsShort, documentAskExtractCosts, documentParseCosts, formatsByTierDescription, specializedAskExtractCosts, specializedParseCosts, tierLimits, } from "@pdfvector/util";
1
2
  /**
2
3
  * All MIME types accepted for file uploads across all API endpoints.
3
4
  * Single source of truth — imported by all contract schemas.
@@ -38,69 +39,70 @@ export const supportedFileMimes = [
38
39
  // Bibliography / Academic
39
40
  "application/x-bibtex",
40
41
  ];
41
- export const supportedFileFormatsDescription = "PDF, DOCX, XLSX, PPTX, CSV, PNG, JPG, TIFF, BMP, HEIF, TXT, MD, TSV, XML, RTF, HTML, ODT, ODS, ODP, EPUB, BIB, RIS, NBIB, ENW";
42
+ export const supportedFileFormatsDescription = allSupportedFormatsShort;
42
43
  /**
43
44
  * Human-readable description of supported file types with extensions.
44
45
  * Used in route-level API descriptions.
45
46
  */
46
- export const supportedFileTypesLong = "PDF, Word (.docx), Excel (.xlsx), PowerPoint (.pptx), CSV, " +
47
- "Image (.png, .jpg, .tiff, .bmp, .heif), " +
48
- "Plain Text (.txt, .md, .tsv, .xml), RTF, HTML, " +
49
- "OpenDocument (.odt, .ods, .odp), EPUB, " +
50
- "and Bibliography (.bib, .ris, .nbib, .enw) files";
51
- /**
52
- * Per-tier file type support descriptions for model input fields.
53
- * Format lists are stated once at the bottom to avoid wall-of-text in Scalar.
54
- */
55
- const formatNote = "\n\n" +
56
- "Supported formats by tier:\n" +
57
- "- All tiers: PDF, Word, Excel, PowerPoint, CSV, Text, HTML, RTF, OpenDocument, EPUB, Bibliography.\n" +
58
- "- Pro adds: Image (PNG, JPG).\n" +
59
- "- Max/Auto adds: Image (PNG, JPG, TIFF, BMP, HEIF).";
47
+ export const supportedFileTypesLong = allSupportedFormatsLong;
48
+ const formatNote = `\n\n${formatsByTierDescription}`;
49
+ function fmtSize(bytes) {
50
+ return `${bytes / (1024 * 1024)}MB`;
51
+ }
52
+ function tierDesc(tier, credits, unit, extra) {
53
+ const limit = tierLimits[tier];
54
+ const limitStr = limit
55
+ ? `Up to ${limit.maxPages} pages, ${fmtSize(limit.maxFileSize)}.`
56
+ : "";
57
+ return `- ${tier}: ${credits} ${unit}. ${extra}${limitStr ? ` ${limitStr}` : ""}`;
58
+ }
59
+ // biome-ignore lint/style/noNonNullAssertion: auto tier always exists
60
+ const autoLimit = tierLimits.auto;
61
+ const autoLimitStr = `Up to ${autoLimit.maxPages} pages, ${fmtSize(autoLimit.maxFileSize)}.`;
60
62
  /** Model tier descriptions for document parse endpoints. */
61
63
  export const documentParseModelDescription = "Model tier for parsing.\n\n" +
62
- "- auto (default): Intelligent fallback. Up to 1000 pages, 500MB.\n" +
63
- "- nano: 1 credit/page. Simple plain text documents. Up to 30 pages, 10MB.\n" +
64
- "- mini: 2 credits/page. Documents with tables and structured content. Up to 30 pages, 10MB.\n" +
65
- "- pro: 4 credits/page. Tables, handwritten text, figures, math, Arabic. Up to 30 pages, 40MB.\n" +
66
- "- max: 8 credits/page. Full Pro capabilities + enhanced multilingual. Up to 1000 pages, 500MB." +
64
+ `- auto (default): Intelligent fallback credits based on the tier selected automatically. ${autoLimitStr}\n` +
65
+ `${tierDesc("nano", documentParseCosts.nano, "credit/page", "Simple plain text documents.")}\n` +
66
+ `${tierDesc("mini", documentParseCosts.mini, "credits/page", "Documents with tables and structured content.")}\n` +
67
+ `${tierDesc("pro", documentParseCosts.pro, "credits/page", "Tables, handwritten text, figures, math, Arabic.")}\n` +
68
+ `${tierDesc("max", documentParseCosts.max, "credits/page", "Full Pro capabilities + enhanced multilingual.")}` +
67
69
  formatNote;
68
70
  /** Model tier descriptions for document extract endpoints. */
69
71
  export const documentExtractModelDescription = "Model tier for extracting structured data.\n\n" +
70
- "- auto (default): Automatically selects the best tier based on document complexity.\n" +
71
- "- nano: 2 credits/page. Fastest. Best for simple documents with straightforward schemas.\n" +
72
- "- mini: 4 credits/page. Balanced speed and accuracy. Moderately complex schemas.\n" +
73
- "- pro: 8 credits/page. High accuracy for complex documents with large or nested schemas.\n" +
74
- "- max: 16 credits/page. Maximum accuracy. Best for difficult extractions requiring deep reasoning." +
72
+ "- auto (default): Automatically selects the best tier — credits based on the tier selected.\n" +
73
+ `- nano: ${documentAskExtractCosts.nano} credits/page. Fastest. Best for simple documents with straightforward schemas.\n` +
74
+ `- mini: ${documentAskExtractCosts.mini} credits/page. Balanced speed and accuracy. Moderately complex schemas.\n` +
75
+ `- pro: ${documentAskExtractCosts.pro} credits/page. High accuracy for complex documents with large or nested schemas.\n` +
76
+ `- max: ${documentAskExtractCosts.max} credits/page. Maximum accuracy. Best for difficult extractions requiring deep reasoning.` +
75
77
  formatNote;
76
78
  /** Model tier descriptions for document ask endpoints. */
77
79
  export const documentAskModelDescription = "Model tier for answering the question.\n\n" +
78
- "- auto (default): Automatically selects the best tier based on document complexity.\n" +
79
- "- nano: 2 credits/page. Fastest. Best for simple questions about straightforward documents.\n" +
80
- "- mini: 4 credits/page. Balanced speed and accuracy. Moderately complex questions.\n" +
81
- "- pro: 8 credits/page. High accuracy for nuanced questions about complex documents.\n" +
82
- "- max: 16 credits/page. Maximum accuracy. Best for difficult questions requiring deep reasoning." +
80
+ "- auto (default): Automatically selects the best tier — credits based on the tier selected.\n" +
81
+ `- nano: ${documentAskExtractCosts.nano} credits/page. Fastest. Best for simple questions about straightforward documents.\n` +
82
+ `- mini: ${documentAskExtractCosts.mini} credits/page. Balanced speed and accuracy. Moderately complex questions.\n` +
83
+ `- pro: ${documentAskExtractCosts.pro} credits/page. High accuracy for nuanced questions about complex documents.\n` +
84
+ `- max: ${documentAskExtractCosts.max} credits/page. Maximum accuracy. Best for difficult questions requiring deep reasoning.` +
83
85
  formatNote;
84
86
  /** Model tier descriptions for invoice/identity/bankStatement parse endpoints (pro/max/auto only). */
85
87
  export const specializedParseModelDescription = (type) => "Model tier for parsing.\n\n" +
86
- "- auto (default): Intelligent fallback.\n" +
87
- `- pro: 6 credits/page. Extracts structured ${type} fields with standard accuracy.\n` +
88
- `- max: 10 credits/page. Extracts structured ${type} fields with highest accuracy and fallback.`;
88
+ "- auto (default): Intelligent fallback — credits based on the tier selected.\n" +
89
+ `- pro: ${specializedParseCosts.pro} credits/page. Extracts structured ${type} fields with standard accuracy.\n` +
90
+ `- max: ${specializedParseCosts.max} credits/page. Extracts structured ${type} fields with highest accuracy and fallback.`;
89
91
  /** Model tier descriptions for invoice/identity/bankStatement extract endpoints. */
90
92
  export const specializedExtractModelDescription = "Model tier for extracting structured data.\n\n" +
91
- "- auto (default): Automatically selects the best tier based on document complexity.\n" +
92
- "- nano: 6 credits/page. Fastest. Best for simple documents with straightforward schemas.\n" +
93
- "- mini: 10 credits/page. Balanced speed and accuracy. Moderately complex schemas.\n" +
94
- "- pro: 14 credits/page. High accuracy for complex documents with large or nested schemas.\n" +
95
- "- max: 18 credits/page. Maximum accuracy. Best for difficult extractions requiring deep reasoning." +
93
+ "- auto (default): Automatically selects the best tier — credits based on the tier selected.\n" +
94
+ `- nano: ${specializedAskExtractCosts.nano} credits/page. Fastest. Best for simple documents with straightforward schemas.\n` +
95
+ `- mini: ${specializedAskExtractCosts.mini} credits/page. Balanced speed and accuracy. Moderately complex schemas.\n` +
96
+ `- pro: ${specializedAskExtractCosts.pro} credits/page. High accuracy for complex documents with large or nested schemas.\n` +
97
+ `- max: ${specializedAskExtractCosts.max} credits/page. Maximum accuracy. Best for difficult extractions requiring deep reasoning.` +
96
98
  formatNote;
97
99
  /** Model tier descriptions for invoice/identity/bankStatement ask endpoints. */
98
100
  export const specializedAskModelDescription = "Model tier for answering the question.\n\n" +
99
- "- auto (default): Automatically selects the best tier based on document complexity.\n" +
100
- "- nano: 6 credits/page. Fastest. Best for simple questions about straightforward documents.\n" +
101
- "- mini: 10 credits/page. Balanced speed and accuracy. Moderately complex questions.\n" +
102
- "- pro: 14 credits/page. High accuracy for nuanced questions about complex documents.\n" +
103
- "- max: 18 credits/page. Maximum accuracy. Best for difficult questions requiring deep reasoning." +
101
+ "- auto (default): Automatically selects the best tier — credits based on the tier selected.\n" +
102
+ `- nano: ${specializedAskExtractCosts.nano} credits/page. Fastest. Best for simple questions about straightforward documents.\n` +
103
+ `- mini: ${specializedAskExtractCosts.mini} credits/page. Balanced speed and accuracy. Moderately complex questions.\n` +
104
+ `- pro: ${specializedAskExtractCosts.pro} credits/page. High accuracy for nuanced questions about complex documents.\n` +
105
+ `- max: ${specializedAskExtractCosts.max} credits/page. Maximum accuracy. Best for difficult questions requiring deep reasoning.` +
104
106
  formatNote;
105
107
  /** Output model description for parse results. */
106
108
  export const outputModelDescription = "Model tier used to parse the document.\n\n" +
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @pdfvector/instance-contract
2
2
 
3
+ ## 0.0.33
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#176](https://github.com/phuctm97/pdfvector/pull/176) [`cfbc548`](https://github.com/phuctm97/pdfvector/commit/cfbc54864ef055bb68ea081b3ead7ba69ca2c819) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add free usage sync, centralize tier limits/credits, deduplicate parse handlers
9
+
10
+ - Updated dependencies [[`cfbc548`](https://github.com/phuctm97/pdfvector/commit/cfbc54864ef055bb68ea081b3ead7ba69ca2c819)]:
11
+ - @pdfvector/util@0.0.17
12
+
13
+ ## 0.0.32
14
+ ### Patch Changes
15
+
16
+
17
+
18
+ - [#159](https://github.com/phuctm97/pdfvector/pull/159) [`931317b`](https://github.com/phuctm97/pdfvector/commit/931317bd4732e56147d11f48cf6a203aa9983db2) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add admin user detail sheet and plan/credits columns
19
+
3
20
  ## 0.0.31
4
21
  ### Patch Changes
5
22
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@pdfvector/instance-contract",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "type": "module",
5
- "description": "API contract definitions for PDFVector instance server",
5
+ "description": "API contract definitions for PDF Vector instance server",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -20,7 +20,8 @@
20
20
  },
21
21
  "main": ".tsc/lib/index.js",
22
22
  "dependencies": {
23
- "@orpc/contract": "^1.13.13"
23
+ "@orpc/contract": "^1.13.13",
24
+ "@pdfvector/util": "0.0.16"
24
25
  },
25
26
  "peerDependencies": {
26
27
  "zod": "^4.3.6"