@openrouter/sdk 1.5.24 → 1.5.25
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/esm/funcs/alphaExtractionsCreate.d.ts +19 -0
- package/esm/funcs/alphaExtractionsCreate.js +105 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/decisionsresponse.d.ts +3 -3
- package/esm/models/decisionsresponse.js +3 -3
- package/esm/models/extractiondateanswer.d.ts +46 -0
- package/esm/models/extractiondateanswer.js +37 -0
- package/esm/models/extractiondatefield.d.ts +22 -0
- package/esm/models/extractiondatefield.js +20 -0
- package/esm/models/extractiondatetimeanswer.d.ts +46 -0
- package/esm/models/extractiondatetimeanswer.js +37 -0
- package/esm/models/extractiondatetimefield.d.ts +22 -0
- package/esm/models/extractiondatetimefield.js +20 -0
- package/esm/models/extractiondurationanswer.d.ts +50 -0
- package/esm/models/extractiondurationanswer.js +38 -0
- package/esm/models/extractiondurationfield.d.ts +34 -0
- package/esm/models/extractiondurationfield.js +23 -0
- package/esm/models/extractionestimateanswer.d.ts +89 -0
- package/esm/models/extractionestimateanswer.js +80 -0
- package/esm/models/extractionestimatefield.d.ts +70 -0
- package/esm/models/extractionestimatefield.js +65 -0
- package/esm/models/extractionforecastanswer.d.ts +72 -0
- package/esm/models/extractionforecastanswer.js +72 -0
- package/esm/models/extractionforecastfield.d.ts +90 -0
- package/esm/models/extractionforecastfield.js +80 -0
- package/esm/models/extractionforecaststep.d.ts +50 -0
- package/esm/models/extractionforecaststep.js +57 -0
- package/esm/models/extractionlistanswer.d.ts +51 -0
- package/esm/models/extractionlistanswer.js +47 -0
- package/esm/models/extractionlistfield.d.ts +38 -0
- package/esm/models/extractionlistfield.js +31 -0
- package/esm/models/extractionnumberanswer.d.ts +46 -0
- package/esm/models/extractionnumberanswer.js +37 -0
- package/esm/models/extractionnumberfield.d.ts +31 -0
- package/esm/models/extractionnumberfield.js +23 -0
- package/esm/models/extractionsrequest.d.ts +75 -0
- package/esm/models/extractionsrequest.js +65 -0
- package/esm/models/extractionsresponse.d.ts +42 -0
- package/esm/models/extractionsresponse.js +61 -0
- package/esm/models/extractionsusage.d.ts +19 -0
- package/esm/models/extractionsusage.js +29 -0
- package/esm/models/extractiontextanswer.d.ts +46 -0
- package/esm/models/extractiontextanswer.js +37 -0
- package/esm/models/extractiontextfield.d.ts +22 -0
- package/esm/models/extractiontextfield.js +20 -0
- package/esm/models/extractiontimeanswer.d.ts +46 -0
- package/esm/models/extractiontimeanswer.js +37 -0
- package/esm/models/extractiontimefield.d.ts +22 -0
- package/esm/models/extractiontimefield.js +20 -0
- package/esm/models/generationresponse.d.ts +1 -0
- package/esm/models/generationresponse.js +1 -0
- package/esm/models/index.d.ts +22 -0
- package/esm/models/index.js +22 -0
- package/esm/models/operations/createapialphaextractions.d.ts +57 -0
- package/esm/models/operations/createapialphaextractions.js +26 -0
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.js +1 -0
- package/esm/sdk/alpha.d.ts +3 -0
- package/esm/sdk/alpha.js +4 -0
- package/esm/sdk/extractions.d.ts +13 -0
- package/esm/sdk/extractions.js +19 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 2c4d0e7507e5
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { discriminatedUnion } from "../types/discriminatedUnion.js";
|
|
9
|
+
import { ExtractionDateAnswer$inboundSchema, } from "./extractiondateanswer.js";
|
|
10
|
+
import { ExtractionDatetimeAnswer$inboundSchema, } from "./extractiondatetimeanswer.js";
|
|
11
|
+
import { ExtractionDurationAnswer$inboundSchema, } from "./extractiondurationanswer.js";
|
|
12
|
+
import { ExtractionEstimateAnswer$inboundSchema, } from "./extractionestimateanswer.js";
|
|
13
|
+
import { ExtractionForecastAnswer$inboundSchema, } from "./extractionforecastanswer.js";
|
|
14
|
+
import { ExtractionListAnswer$inboundSchema, } from "./extractionlistanswer.js";
|
|
15
|
+
import { ExtractionNumberAnswer$inboundSchema, } from "./extractionnumberanswer.js";
|
|
16
|
+
import { ExtractionsUsage$inboundSchema, } from "./extractionsusage.js";
|
|
17
|
+
import { ExtractionTextAnswer$inboundSchema, } from "./extractiontextanswer.js";
|
|
18
|
+
import { ExtractionTimeAnswer$inboundSchema, } from "./extractiontimeanswer.js";
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const ExtractionsResponseAnswers$inboundSchema = discriminatedUnion("type", {
|
|
21
|
+
date: ExtractionDateAnswer$inboundSchema,
|
|
22
|
+
datetime: ExtractionDatetimeAnswer$inboundSchema,
|
|
23
|
+
duration: ExtractionDurationAnswer$inboundSchema,
|
|
24
|
+
estimate: ExtractionEstimateAnswer$inboundSchema,
|
|
25
|
+
forecast: ExtractionForecastAnswer$inboundSchema,
|
|
26
|
+
list: ExtractionListAnswer$inboundSchema,
|
|
27
|
+
number: ExtractionNumberAnswer$inboundSchema,
|
|
28
|
+
text: ExtractionTextAnswer$inboundSchema,
|
|
29
|
+
time: ExtractionTimeAnswer$inboundSchema,
|
|
30
|
+
});
|
|
31
|
+
export function extractionsResponseAnswersFromJSON(jsonString) {
|
|
32
|
+
return safeParse(jsonString, (x) => ExtractionsResponseAnswers$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionsResponseAnswers' from JSON`);
|
|
33
|
+
}
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const ExtractionsResponse$inboundSchema = z.object({
|
|
36
|
+
answers: z.record(z.string(), discriminatedUnion("type", {
|
|
37
|
+
date: ExtractionDateAnswer$inboundSchema,
|
|
38
|
+
datetime: ExtractionDatetimeAnswer$inboundSchema,
|
|
39
|
+
duration: ExtractionDurationAnswer$inboundSchema,
|
|
40
|
+
estimate: ExtractionEstimateAnswer$inboundSchema,
|
|
41
|
+
forecast: ExtractionForecastAnswer$inboundSchema,
|
|
42
|
+
list: ExtractionListAnswer$inboundSchema,
|
|
43
|
+
number: ExtractionNumberAnswer$inboundSchema,
|
|
44
|
+
text: ExtractionTextAnswer$inboundSchema,
|
|
45
|
+
time: ExtractionTimeAnswer$inboundSchema,
|
|
46
|
+
})),
|
|
47
|
+
id: z.string().optional(),
|
|
48
|
+
model: z.string(),
|
|
49
|
+
provider: z.string().optional(),
|
|
50
|
+
state_text: z.nullable(z.string()).optional(),
|
|
51
|
+
truncated: z.boolean().optional(),
|
|
52
|
+
usage: ExtractionsUsage$inboundSchema,
|
|
53
|
+
}).transform((v) => {
|
|
54
|
+
return remap$(v, {
|
|
55
|
+
"state_text": "stateText",
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
export function extractionsResponseFromJSON(jsonString) {
|
|
59
|
+
return safeParse(jsonString, (x) => ExtractionsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionsResponse' from JSON`);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=extractionsresponse.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
export type ExtractionsUsage = {
|
|
5
|
+
cost?: number | undefined;
|
|
6
|
+
imageTokens?: number | undefined;
|
|
7
|
+
inputTokens: number;
|
|
8
|
+
outputTokens: number;
|
|
9
|
+
/**
|
|
10
|
+
* Number of upstream passes when the fields did not fit in one.
|
|
11
|
+
*/
|
|
12
|
+
passes?: number | undefined;
|
|
13
|
+
schemaTokens?: number | undefined;
|
|
14
|
+
stateTokens?: number | undefined;
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export declare const ExtractionsUsage$inboundSchema: z.ZodType<ExtractionsUsage, unknown>;
|
|
18
|
+
export declare function extractionsUsageFromJSON(jsonString: string): SafeParseResult<ExtractionsUsage, SDKValidationError>;
|
|
19
|
+
//# sourceMappingURL=extractionsusage.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 539fcca69ecb
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const ExtractionsUsage$inboundSchema = z.object({
|
|
10
|
+
cost: z.number().optional(),
|
|
11
|
+
image_tokens: z.int().optional(),
|
|
12
|
+
input_tokens: z.int(),
|
|
13
|
+
output_tokens: z.int(),
|
|
14
|
+
passes: z.int().optional(),
|
|
15
|
+
schema_tokens: z.int().optional(),
|
|
16
|
+
state_tokens: z.int().optional(),
|
|
17
|
+
}).transform((v) => {
|
|
18
|
+
return remap$(v, {
|
|
19
|
+
"image_tokens": "imageTokens",
|
|
20
|
+
"input_tokens": "inputTokens",
|
|
21
|
+
"output_tokens": "outputTokens",
|
|
22
|
+
"schema_tokens": "schemaTokens",
|
|
23
|
+
"state_tokens": "stateTokens",
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
export function extractionsUsageFromJSON(jsonString) {
|
|
27
|
+
return safeParse(jsonString, (x) => ExtractionsUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionsUsage' from JSON`);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=extractionsusage.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
/**
|
|
6
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ExtractionTextAnswerSource: {
|
|
9
|
+
readonly State: "state";
|
|
10
|
+
readonly Image: "image";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
14
|
+
*/
|
|
15
|
+
export type ExtractionTextAnswerSource = OpenEnum<typeof ExtractionTextAnswerSource>;
|
|
16
|
+
export type ExtractionTextAnswer = {
|
|
17
|
+
confidence?: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The most likely value even when `value` is null because `p_null` crossed the threshold.
|
|
20
|
+
*/
|
|
21
|
+
guess?: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Probability that the state contains nothing for this field.
|
|
24
|
+
*/
|
|
25
|
+
pNull?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
28
|
+
*/
|
|
29
|
+
source?: ExtractionTextAnswerSource | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once.
|
|
32
|
+
*/
|
|
33
|
+
span?: Array<number> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Confidence in the spelling of text read from an image.
|
|
36
|
+
*/
|
|
37
|
+
spellConfidence?: number | undefined;
|
|
38
|
+
type: "text";
|
|
39
|
+
value: string | null;
|
|
40
|
+
};
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const ExtractionTextAnswerSource$inboundSchema: z.ZodType<ExtractionTextAnswerSource, unknown>;
|
|
43
|
+
/** @internal */
|
|
44
|
+
export declare const ExtractionTextAnswer$inboundSchema: z.ZodType<ExtractionTextAnswer, unknown>;
|
|
45
|
+
export declare function extractionTextAnswerFromJSON(jsonString: string): SafeParseResult<ExtractionTextAnswer, SDKValidationError>;
|
|
46
|
+
//# sourceMappingURL=extractiontextanswer.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 4c006742e2fc
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../types/enums.js";
|
|
9
|
+
/**
|
|
10
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
11
|
+
*/
|
|
12
|
+
export const ExtractionTextAnswerSource = {
|
|
13
|
+
State: "state",
|
|
14
|
+
Image: "image",
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ExtractionTextAnswerSource$inboundSchema = openEnums.inboundSchema(ExtractionTextAnswerSource);
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const ExtractionTextAnswer$inboundSchema = z.object({
|
|
20
|
+
confidence: z.number().optional(),
|
|
21
|
+
guess: z.string().optional(),
|
|
22
|
+
p_null: z.number().optional(),
|
|
23
|
+
source: ExtractionTextAnswerSource$inboundSchema.optional(),
|
|
24
|
+
span: z.array(z.int()).optional(),
|
|
25
|
+
spell_confidence: z.number().optional(),
|
|
26
|
+
type: z.literal("text"),
|
|
27
|
+
value: z.nullable(z.string()),
|
|
28
|
+
}).transform((v) => {
|
|
29
|
+
return remap$(v, {
|
|
30
|
+
"p_null": "pNull",
|
|
31
|
+
"spell_confidence": "spellConfidence",
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
export function extractionTextAnswerFromJSON(jsonString) {
|
|
35
|
+
return safeParse(jsonString, (x) => ExtractionTextAnswer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionTextAnswer' from JSON`);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=extractiontextanswer.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type ExtractionTextField = {
|
|
3
|
+
/**
|
|
4
|
+
* What the field should contain.
|
|
5
|
+
*/
|
|
6
|
+
instructions?: string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Probability of null above which `value` is null. Default 0.5.
|
|
9
|
+
*/
|
|
10
|
+
nullThreshold?: number | undefined;
|
|
11
|
+
type: "text";
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export type ExtractionTextField$Outbound = {
|
|
15
|
+
instructions?: string | undefined;
|
|
16
|
+
null_threshold?: number | undefined;
|
|
17
|
+
type: "text";
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const ExtractionTextField$outboundSchema: z.ZodType<ExtractionTextField$Outbound, ExtractionTextField>;
|
|
21
|
+
export declare function extractionTextFieldToJSON(extractionTextField: ExtractionTextField): string;
|
|
22
|
+
//# sourceMappingURL=extractiontextfield.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 601482d94cbe
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const ExtractionTextField$outboundSchema = z.object({
|
|
9
|
+
instructions: z.string().optional(),
|
|
10
|
+
nullThreshold: z.number().optional(),
|
|
11
|
+
type: z.literal("text"),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return remap$(v, {
|
|
14
|
+
nullThreshold: "null_threshold",
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
export function extractionTextFieldToJSON(extractionTextField) {
|
|
18
|
+
return JSON.stringify(ExtractionTextField$outboundSchema.parse(extractionTextField));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=extractiontextfield.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
/**
|
|
6
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ExtractionTimeAnswerSource: {
|
|
9
|
+
readonly State: "state";
|
|
10
|
+
readonly Image: "image";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
14
|
+
*/
|
|
15
|
+
export type ExtractionTimeAnswerSource = OpenEnum<typeof ExtractionTimeAnswerSource>;
|
|
16
|
+
export type ExtractionTimeAnswer = {
|
|
17
|
+
confidence?: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The most likely value even when `value` is null because `p_null` crossed the threshold.
|
|
20
|
+
*/
|
|
21
|
+
guess?: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Probability that the state contains nothing for this field.
|
|
24
|
+
*/
|
|
25
|
+
pNull?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
28
|
+
*/
|
|
29
|
+
source?: ExtractionTimeAnswerSource | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once.
|
|
32
|
+
*/
|
|
33
|
+
span?: Array<number> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Confidence in the spelling of text read from an image.
|
|
36
|
+
*/
|
|
37
|
+
spellConfidence?: number | undefined;
|
|
38
|
+
type: "time";
|
|
39
|
+
value: string | null;
|
|
40
|
+
};
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const ExtractionTimeAnswerSource$inboundSchema: z.ZodType<ExtractionTimeAnswerSource, unknown>;
|
|
43
|
+
/** @internal */
|
|
44
|
+
export declare const ExtractionTimeAnswer$inboundSchema: z.ZodType<ExtractionTimeAnswer, unknown>;
|
|
45
|
+
export declare function extractionTimeAnswerFromJSON(jsonString: string): SafeParseResult<ExtractionTimeAnswer, SDKValidationError>;
|
|
46
|
+
//# sourceMappingURL=extractiontimeanswer.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: bf3ef8199855
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../types/enums.js";
|
|
9
|
+
/**
|
|
10
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
11
|
+
*/
|
|
12
|
+
export const ExtractionTimeAnswerSource = {
|
|
13
|
+
State: "state",
|
|
14
|
+
Image: "image",
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ExtractionTimeAnswerSource$inboundSchema = openEnums.inboundSchema(ExtractionTimeAnswerSource);
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const ExtractionTimeAnswer$inboundSchema = z.object({
|
|
20
|
+
confidence: z.number().optional(),
|
|
21
|
+
guess: z.string().optional(),
|
|
22
|
+
p_null: z.number().optional(),
|
|
23
|
+
source: ExtractionTimeAnswerSource$inboundSchema.optional(),
|
|
24
|
+
span: z.array(z.int()).optional(),
|
|
25
|
+
spell_confidence: z.number().optional(),
|
|
26
|
+
type: z.literal("time"),
|
|
27
|
+
value: z.nullable(z.string()),
|
|
28
|
+
}).transform((v) => {
|
|
29
|
+
return remap$(v, {
|
|
30
|
+
"p_null": "pNull",
|
|
31
|
+
"spell_confidence": "spellConfidence",
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
export function extractionTimeAnswerFromJSON(jsonString) {
|
|
35
|
+
return safeParse(jsonString, (x) => ExtractionTimeAnswer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionTimeAnswer' from JSON`);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=extractiontimeanswer.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type ExtractionTimeField = {
|
|
3
|
+
/**
|
|
4
|
+
* What the field should contain.
|
|
5
|
+
*/
|
|
6
|
+
instructions?: string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Probability of null above which `value` is null. Default 0.5.
|
|
9
|
+
*/
|
|
10
|
+
nullThreshold?: number | undefined;
|
|
11
|
+
type: "time";
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export type ExtractionTimeField$Outbound = {
|
|
15
|
+
instructions?: string | undefined;
|
|
16
|
+
null_threshold?: number | undefined;
|
|
17
|
+
type: "time";
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const ExtractionTimeField$outboundSchema: z.ZodType<ExtractionTimeField$Outbound, ExtractionTimeField>;
|
|
21
|
+
export declare function extractionTimeFieldToJSON(extractionTimeField: ExtractionTimeField): string;
|
|
22
|
+
//# sourceMappingURL=extractiontimefield.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 20957cc003d4
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const ExtractionTimeField$outboundSchema = z.object({
|
|
9
|
+
instructions: z.string().optional(),
|
|
10
|
+
nullThreshold: z.number().optional(),
|
|
11
|
+
type: z.literal("time"),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return remap$(v, {
|
|
14
|
+
nullThreshold: "null_threshold",
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
export function extractionTimeFieldToJSON(extractionTimeField) {
|
|
18
|
+
return JSON.stringify(ExtractionTimeField$outboundSchema.parse(extractionTimeField));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=extractiontimefield.js.map
|
package/esm/models/index.d.ts
CHANGED
|
@@ -331,6 +331,28 @@ export * from "./enumcapability.js";
|
|
|
331
331
|
export * from "./errorevent.js";
|
|
332
332
|
export * from "./externaluser.js";
|
|
333
333
|
export * from "./externaluserresponse.js";
|
|
334
|
+
export * from "./extractiondateanswer.js";
|
|
335
|
+
export * from "./extractiondatefield.js";
|
|
336
|
+
export * from "./extractiondatetimeanswer.js";
|
|
337
|
+
export * from "./extractiondatetimefield.js";
|
|
338
|
+
export * from "./extractiondurationanswer.js";
|
|
339
|
+
export * from "./extractiondurationfield.js";
|
|
340
|
+
export * from "./extractionestimateanswer.js";
|
|
341
|
+
export * from "./extractionestimatefield.js";
|
|
342
|
+
export * from "./extractionforecastanswer.js";
|
|
343
|
+
export * from "./extractionforecastfield.js";
|
|
344
|
+
export * from "./extractionforecaststep.js";
|
|
345
|
+
export * from "./extractionlistanswer.js";
|
|
346
|
+
export * from "./extractionlistfield.js";
|
|
347
|
+
export * from "./extractionnumberanswer.js";
|
|
348
|
+
export * from "./extractionnumberfield.js";
|
|
349
|
+
export * from "./extractionsrequest.js";
|
|
350
|
+
export * from "./extractionsresponse.js";
|
|
351
|
+
export * from "./extractionsusage.js";
|
|
352
|
+
export * from "./extractiontextanswer.js";
|
|
353
|
+
export * from "./extractiontextfield.js";
|
|
354
|
+
export * from "./extractiontimeanswer.js";
|
|
355
|
+
export * from "./extractiontimefield.js";
|
|
334
356
|
export * from "./failabletoolcallstatus.js";
|
|
335
357
|
export * from "./filecitation.js";
|
|
336
358
|
export * from "./filedeleteresponse.js";
|
package/esm/models/index.js
CHANGED
|
@@ -335,6 +335,28 @@ export * from "./enumcapability.js";
|
|
|
335
335
|
export * from "./errorevent.js";
|
|
336
336
|
export * from "./externaluser.js";
|
|
337
337
|
export * from "./externaluserresponse.js";
|
|
338
|
+
export * from "./extractiondateanswer.js";
|
|
339
|
+
export * from "./extractiondatefield.js";
|
|
340
|
+
export * from "./extractiondatetimeanswer.js";
|
|
341
|
+
export * from "./extractiondatetimefield.js";
|
|
342
|
+
export * from "./extractiondurationanswer.js";
|
|
343
|
+
export * from "./extractiondurationfield.js";
|
|
344
|
+
export * from "./extractionestimateanswer.js";
|
|
345
|
+
export * from "./extractionestimatefield.js";
|
|
346
|
+
export * from "./extractionforecastanswer.js";
|
|
347
|
+
export * from "./extractionforecastfield.js";
|
|
348
|
+
export * from "./extractionforecaststep.js";
|
|
349
|
+
export * from "./extractionlistanswer.js";
|
|
350
|
+
export * from "./extractionlistfield.js";
|
|
351
|
+
export * from "./extractionnumberanswer.js";
|
|
352
|
+
export * from "./extractionnumberfield.js";
|
|
353
|
+
export * from "./extractionsrequest.js";
|
|
354
|
+
export * from "./extractionsresponse.js";
|
|
355
|
+
export * from "./extractionsusage.js";
|
|
356
|
+
export * from "./extractiontextanswer.js";
|
|
357
|
+
export * from "./extractiontextfield.js";
|
|
358
|
+
export * from "./extractiontimeanswer.js";
|
|
359
|
+
export * from "./extractiontimefield.js";
|
|
338
360
|
export * from "./failabletoolcallstatus.js";
|
|
339
361
|
export * from "./filecitation.js";
|
|
340
362
|
export * from "./filedeleteresponse.js";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as models from "../index.js";
|
|
3
|
+
export declare const CreateApiAlphaExtractionsServerList: readonly ["https://openrouter.ai"];
|
|
4
|
+
export type CreateApiAlphaExtractionsGlobals = {
|
|
5
|
+
/**
|
|
6
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This is used to track API usage per application.
|
|
10
|
+
*/
|
|
11
|
+
httpReferer?: string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
*/
|
|
17
|
+
appTitle?: string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
*/
|
|
23
|
+
appCategories?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
export type CreateApiAlphaExtractionsRequest = {
|
|
26
|
+
/**
|
|
27
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* This is used to track API usage per application.
|
|
31
|
+
*/
|
|
32
|
+
httpReferer?: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
*/
|
|
38
|
+
appTitle?: string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
*/
|
|
44
|
+
appCategories?: string | undefined;
|
|
45
|
+
extractionsRequest: models.ExtractionsRequest;
|
|
46
|
+
};
|
|
47
|
+
/** @internal */
|
|
48
|
+
export type CreateApiAlphaExtractionsRequest$Outbound = {
|
|
49
|
+
"HTTP-Referer"?: string | undefined;
|
|
50
|
+
appTitle?: string | undefined;
|
|
51
|
+
appCategories?: string | undefined;
|
|
52
|
+
ExtractionsRequest: models.ExtractionsRequest$Outbound;
|
|
53
|
+
};
|
|
54
|
+
/** @internal */
|
|
55
|
+
export declare const CreateApiAlphaExtractionsRequest$outboundSchema: z.ZodType<CreateApiAlphaExtractionsRequest$Outbound, CreateApiAlphaExtractionsRequest>;
|
|
56
|
+
export declare function createApiAlphaExtractionsRequestToJSON(createApiAlphaExtractionsRequest: CreateApiAlphaExtractionsRequest): string;
|
|
57
|
+
//# sourceMappingURL=createapialphaextractions.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: b3543519030d
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { ExtractionsRequest$outboundSchema as models_ExtractionsRequest$outboundSchema } from "../extractionsrequest.js";
|
|
8
|
+
export const CreateApiAlphaExtractionsServerList = [
|
|
9
|
+
"https://openrouter.ai",
|
|
10
|
+
];
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const CreateApiAlphaExtractionsRequest$outboundSchema = z.object({
|
|
13
|
+
httpReferer: z.string().optional(),
|
|
14
|
+
appTitle: z.string().optional(),
|
|
15
|
+
appCategories: z.string().optional(),
|
|
16
|
+
extractionsRequest: models_ExtractionsRequest$outboundSchema,
|
|
17
|
+
}).transform((v) => {
|
|
18
|
+
return remap$(v, {
|
|
19
|
+
httpReferer: "HTTP-Referer",
|
|
20
|
+
extractionsRequest: "ExtractionsRequest",
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
export function createApiAlphaExtractionsRequestToJSON(createApiAlphaExtractionsRequest) {
|
|
24
|
+
return JSON.stringify(CreateApiAlphaExtractionsRequest$outboundSchema.parse(createApiAlphaExtractionsRequest));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=createapialphaextractions.js.map
|
|
@@ -7,6 +7,7 @@ export * from "./bulkunassignkeysfromguardrail.js";
|
|
|
7
7
|
export * from "./bulkunassignmembersfromguardrail.js";
|
|
8
8
|
export * from "./copyvaultsecretstointern.js";
|
|
9
9
|
export * from "./createapialphadecisions.js";
|
|
10
|
+
export * from "./createapialphaextractions.js";
|
|
10
11
|
export * from "./createaudiospeech.js";
|
|
11
12
|
export * from "./createaudiotranscriptions.js";
|
|
12
13
|
export * from "./createaudiotranscriptionsmultipart.js";
|
|
@@ -11,6 +11,7 @@ export * from "./bulkunassignkeysfromguardrail.js";
|
|
|
11
11
|
export * from "./bulkunassignmembersfromguardrail.js";
|
|
12
12
|
export * from "./copyvaultsecretstointern.js";
|
|
13
13
|
export * from "./createapialphadecisions.js";
|
|
14
|
+
export * from "./createapialphaextractions.js";
|
|
14
15
|
export * from "./createaudiospeech.js";
|
|
15
16
|
export * from "./createaudiotranscriptions.js";
|
|
16
17
|
export * from "./createaudiotranscriptionsmultipart.js";
|
package/esm/sdk/alpha.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ClientSDK } from "../lib/sdks.js";
|
|
2
2
|
import { Decisions } from "./decisions.js";
|
|
3
|
+
import { Extractions } from "./extractions.js";
|
|
3
4
|
export declare class Alpha extends ClientSDK {
|
|
4
5
|
private _decisions?;
|
|
5
6
|
get decisions(): Decisions;
|
|
7
|
+
private _extractions?;
|
|
8
|
+
get extractions(): Extractions;
|
|
6
9
|
}
|
|
7
10
|
//# sourceMappingURL=alpha.d.ts.map
|
package/esm/sdk/alpha.js
CHANGED
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ClientSDK } from "../lib/sdks.js";
|
|
6
6
|
import { Decisions } from "./decisions.js";
|
|
7
|
+
import { Extractions } from "./extractions.js";
|
|
7
8
|
export class Alpha extends ClientSDK {
|
|
8
9
|
get decisions() {
|
|
9
10
|
return (this._decisions ?? (this._decisions = new Decisions(this._options)));
|
|
10
11
|
}
|
|
12
|
+
get extractions() {
|
|
13
|
+
return (this._extractions ?? (this._extractions = new Extractions(this._options)));
|
|
14
|
+
}
|
|
11
15
|
}
|
|
12
16
|
//# sourceMappingURL=alpha.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
|
+
import * as models from "../models/index.js";
|
|
3
|
+
import * as operations from "../models/operations/index.js";
|
|
4
|
+
export declare class Extractions extends ClientSDK {
|
|
5
|
+
/**
|
|
6
|
+
* Submit an Extractions request
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Extracts, computes, estimates or forecasts typed fields from a state string and image assets using an extraction-style System One model. Alpha: the shape is not stable.
|
|
10
|
+
*/
|
|
11
|
+
create(request: operations.CreateApiAlphaExtractionsRequest, options?: RequestOptions): Promise<models.ExtractionsResponse>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=extractions.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 86201a09fb0f
|
|
4
|
+
*/
|
|
5
|
+
import { alphaExtractionsCreate } from "../funcs/alphaExtractionsCreate.js";
|
|
6
|
+
import { ClientSDK } from "../lib/sdks.js";
|
|
7
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
8
|
+
export class Extractions extends ClientSDK {
|
|
9
|
+
/**
|
|
10
|
+
* Submit an Extractions request
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Extracts, computes, estimates or forecasts typed fields from a state string and image assets using an extraction-style System One model. Alpha: the shape is not stable.
|
|
14
|
+
*/
|
|
15
|
+
async create(request, options) {
|
|
16
|
+
return unwrapAsync(alphaExtractionsCreate(this, request, options));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=extractions.js.map
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.25",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc && node scripts/unbarrel-imports.js",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
77
|
-
"test:transit": "exit 0",
|
|
78
|
-
"test:watch": "vitest --watch --project unit",
|
|
79
|
-
"typecheck": "tsc --noEmit",
|
|
80
76
|
"postinstall": "node scripts/check-types.js || true",
|
|
77
|
+
"test:e2e": "vitest --run --project e2e",
|
|
78
|
+
"typecheck:transit": "exit 0",
|
|
79
|
+
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
81
80
|
"prepare": "npm run build",
|
|
82
81
|
"test": "vitest --run --project unit",
|
|
83
|
-
"test:
|
|
84
|
-
"
|
|
82
|
+
"test:transit": "exit 0",
|
|
83
|
+
"test:watch": "vitest --watch --project unit",
|
|
84
|
+
"typecheck": "tsc --noEmit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|