@kortyx/openrouter 0.1.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.
@@ -0,0 +1,58 @@
1
+ export { ProviderConfigurationError, ProviderRequestError } from '@kortyx/core/errors';
2
+ import { ChatRequest, DecisionsRequest } from '@openrouter/sdk/models';
3
+ import { z } from 'zod';
4
+ import { ModelOptions, ProviderModelRef, ProviderInstance, KortyxModel } from '@kortyx/providers';
5
+ import { Fetcher } from '@openrouter/sdk';
6
+
7
+ interface ProviderSettings {
8
+ apiKey?: string | undefined;
9
+ baseUrl?: string | undefined;
10
+ httpReferer?: string | undefined;
11
+ appTitle?: string | undefined;
12
+ appCategories?: string | undefined;
13
+ fetch?: Fetcher | undefined;
14
+ }
15
+ type OpenRouterCallOptions = Omit<ChatRequest, "messages" | "model" | "stream" | "temperature" | "maxCompletionTokens" | "maxTokens" | "stop" | "reasoningEffort" | "responseFormat" | "tools">;
16
+ type OpenRouterModelOptions = ModelOptions & {
17
+ providerOptions?: ({
18
+ openrouter?: OpenRouterCallOptions;
19
+ } & Record<string, unknown>) | undefined;
20
+ };
21
+
22
+ declare const NATIVE_OUTPUT_MARKER: "~kortyx";
23
+ type JevQuestions = DecisionsRequest["questions"];
24
+ type ChoiceOutput<Question> = Question extends {
25
+ type: "choice";
26
+ criteria: infer Criteria;
27
+ } ? Extract<keyof Criteria, string> : never;
28
+ type JevOutput<Questions extends JevQuestions> = {
29
+ [Key in keyof Questions]: Questions[Key] extends {
30
+ type: "choice";
31
+ } ? ChoiceOutput<Questions[Key]> : Questions[Key] extends {
32
+ type: "score" | "noul";
33
+ } ? number : never;
34
+ };
35
+ type JevOutputSchema<Questions extends JevQuestions> = z.ZodType<JevOutput<Questions>> & {
36
+ readonly [NATIVE_OUTPUT_MARKER]: {
37
+ readonly nativeOutput: true;
38
+ };
39
+ };
40
+ /**
41
+ * Builds the regular output schema that lets `useReason` call a TypeSafe Jev
42
+ * model through OpenRouter's System One API.
43
+ */
44
+ declare function jevOutputSchema<const Questions extends JevQuestions>(questions: Questions): JevOutputSchema<Questions>;
45
+
46
+ declare const PROVIDER_ID: "openrouter";
47
+ declare const MODELS: readonly [];
48
+ type ModelId = string & {};
49
+
50
+ type OpenRouterModelRef = ProviderModelRef<typeof PROVIDER_ID, ModelId>;
51
+ interface OpenRouterProvider extends ProviderInstance<typeof PROVIDER_ID, ModelId> {
52
+ (modelId: ModelId, options?: OpenRouterModelOptions): OpenRouterModelRef;
53
+ getModel: (modelId: string, options?: OpenRouterModelOptions) => KortyxModel;
54
+ }
55
+ declare function createOpenRouter(settings?: ProviderSettings): OpenRouterProvider;
56
+ declare const openrouter: OpenRouterProvider;
57
+
58
+ export { type JevOutput, type JevOutputSchema, type JevQuestions, MODELS, type ModelId, type OpenRouterCallOptions, type OpenRouterModelOptions, type OpenRouterModelRef, type OpenRouterProvider, PROVIDER_ID, type ProviderSettings, createOpenRouter, createOpenRouter as createProvider, jevOutputSchema, openrouter };
@@ -0,0 +1,58 @@
1
+ export { ProviderConfigurationError, ProviderRequestError } from '@kortyx/core/errors';
2
+ import { ChatRequest, DecisionsRequest } from '@openrouter/sdk/models';
3
+ import { z } from 'zod';
4
+ import { ModelOptions, ProviderModelRef, ProviderInstance, KortyxModel } from '@kortyx/providers';
5
+ import { Fetcher } from '@openrouter/sdk';
6
+
7
+ interface ProviderSettings {
8
+ apiKey?: string | undefined;
9
+ baseUrl?: string | undefined;
10
+ httpReferer?: string | undefined;
11
+ appTitle?: string | undefined;
12
+ appCategories?: string | undefined;
13
+ fetch?: Fetcher | undefined;
14
+ }
15
+ type OpenRouterCallOptions = Omit<ChatRequest, "messages" | "model" | "stream" | "temperature" | "maxCompletionTokens" | "maxTokens" | "stop" | "reasoningEffort" | "responseFormat" | "tools">;
16
+ type OpenRouterModelOptions = ModelOptions & {
17
+ providerOptions?: ({
18
+ openrouter?: OpenRouterCallOptions;
19
+ } & Record<string, unknown>) | undefined;
20
+ };
21
+
22
+ declare const NATIVE_OUTPUT_MARKER: "~kortyx";
23
+ type JevQuestions = DecisionsRequest["questions"];
24
+ type ChoiceOutput<Question> = Question extends {
25
+ type: "choice";
26
+ criteria: infer Criteria;
27
+ } ? Extract<keyof Criteria, string> : never;
28
+ type JevOutput<Questions extends JevQuestions> = {
29
+ [Key in keyof Questions]: Questions[Key] extends {
30
+ type: "choice";
31
+ } ? ChoiceOutput<Questions[Key]> : Questions[Key] extends {
32
+ type: "score" | "noul";
33
+ } ? number : never;
34
+ };
35
+ type JevOutputSchema<Questions extends JevQuestions> = z.ZodType<JevOutput<Questions>> & {
36
+ readonly [NATIVE_OUTPUT_MARKER]: {
37
+ readonly nativeOutput: true;
38
+ };
39
+ };
40
+ /**
41
+ * Builds the regular output schema that lets `useReason` call a TypeSafe Jev
42
+ * model through OpenRouter's System One API.
43
+ */
44
+ declare function jevOutputSchema<const Questions extends JevQuestions>(questions: Questions): JevOutputSchema<Questions>;
45
+
46
+ declare const PROVIDER_ID: "openrouter";
47
+ declare const MODELS: readonly [];
48
+ type ModelId = string & {};
49
+
50
+ type OpenRouterModelRef = ProviderModelRef<typeof PROVIDER_ID, ModelId>;
51
+ interface OpenRouterProvider extends ProviderInstance<typeof PROVIDER_ID, ModelId> {
52
+ (modelId: ModelId, options?: OpenRouterModelOptions): OpenRouterModelRef;
53
+ getModel: (modelId: string, options?: OpenRouterModelOptions) => KortyxModel;
54
+ }
55
+ declare function createOpenRouter(settings?: ProviderSettings): OpenRouterProvider;
56
+ declare const openrouter: OpenRouterProvider;
57
+
58
+ export { type JevOutput, type JevOutputSchema, type JevQuestions, MODELS, type ModelId, type OpenRouterCallOptions, type OpenRouterModelOptions, type OpenRouterModelRef, type OpenRouterProvider, PROVIDER_ID, type ProviderSettings, createOpenRouter, createOpenRouter as createProvider, jevOutputSchema, openrouter };