@xsai-ext/providers 0.4.0-beta.12 → 0.4.0-beta.13
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/dist/anthropic-Bel15KQV.d.ts +111 -0
- package/dist/create.d.ts +73 -122
- package/dist/create.js +4 -37
- package/dist/index.d.ts +72 -70
- package/dist/index.js +2 -2
- package/dist/player2-D788vRq_.js +47 -0
- package/dist/special/create.d.ts +66 -0
- package/dist/special/create.js +37 -0
- package/dist/special/index.d.ts +12 -0
- package/dist/special/index.js +6 -0
- package/dist/{together-ai-BNlmR9ei.js → together-ai-D5anbRie.js} +2 -2
- package/dist/{anthropic-B6NN_uBS.d.ts → types-Czo87gCh.d.ts} +1 -111
- package/dist/types-DW1hvH0W.d.ts +38 -0
- package/dist/utils/index.d.ts +52 -0
- package/dist/utils/index.js +37 -0
- package/package.json +16 -4
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { M as ModelProvider, a as ChatProviderWithExtraOptions } from './types-DW1hvH0W.js';
|
|
2
|
+
import { O as OpenrouterModels, A as AnthropicModels } from './types-Czo87gCh.js';
|
|
3
|
+
|
|
4
|
+
interface OpenRouterOptions {
|
|
5
|
+
extraHeaders?: (Headers | Record<string, string>) & {
|
|
6
|
+
'HTTP-Referer'?: string;
|
|
7
|
+
'X-Title'?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Model routing
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://openrouter.ai/docs/features/model-routing}
|
|
13
|
+
* @example
|
|
14
|
+
* ```
|
|
15
|
+
* {
|
|
16
|
+
* model: [ 'openai/gpt-1o' ],
|
|
17
|
+
* models: [ 'openai/gpt-4o', 'google/gemini-2.0-flash-001' ],
|
|
18
|
+
* messages: [
|
|
19
|
+
* { role: 'user', content: 'Hello, world!' },
|
|
20
|
+
* ]
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
models?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Provider routing
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://openrouter.ai/docs/features/provider-routing}
|
|
29
|
+
*/
|
|
30
|
+
provider?: {
|
|
31
|
+
/**
|
|
32
|
+
* Whether to allow backup providers when the primary is unavailable.
|
|
33
|
+
*
|
|
34
|
+
* @see {@link https://openrouter.ai/docs/features/provider-routing#disabling-fallbacks}
|
|
35
|
+
* @default true
|
|
36
|
+
* @example false
|
|
37
|
+
*/
|
|
38
|
+
allowFallbacks?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Control whether to use providers that may store data.
|
|
41
|
+
*
|
|
42
|
+
* @see {@link https://openrouter.ai/docs/features/provider-routing#requiring-providers-to-comply-with-data-policies}
|
|
43
|
+
* @default 'allow'
|
|
44
|
+
*/
|
|
45
|
+
dataCollection?: 'allow' | 'deny';
|
|
46
|
+
/**
|
|
47
|
+
* List of provider names to skip for this request.
|
|
48
|
+
*
|
|
49
|
+
* @see {@link https://openrouter.ai/docs/features/provider-routing#ignoring-providers}
|
|
50
|
+
*/
|
|
51
|
+
ignore?: string[];
|
|
52
|
+
/**
|
|
53
|
+
* List of provider names to try in order (e.g. ["Anthropic", "OpenAI"]).
|
|
54
|
+
*
|
|
55
|
+
* @see {@link https://openrouter.ai/docs/features/provider-routing#ordering-specific-providers}
|
|
56
|
+
* @example [ 'Anthropic', 'OpenAI' ]
|
|
57
|
+
*/
|
|
58
|
+
order?: string[];
|
|
59
|
+
/**
|
|
60
|
+
* List of quantization levels to filter by (e.g. ["int4", "int8"]).
|
|
61
|
+
*
|
|
62
|
+
* @see {@link https://openrouter.ai/docs/features/provider-routing#quantization}
|
|
63
|
+
* @example [ 'int4', 'int8' ]
|
|
64
|
+
*/
|
|
65
|
+
quantizations?: string[];
|
|
66
|
+
/**
|
|
67
|
+
* Only use providers that support all parameters in your request.
|
|
68
|
+
*
|
|
69
|
+
* @see {@link https://openrouter.ai/docs/features/provider-routing#requiring-providers-to-support-all-parameters-beta}
|
|
70
|
+
*/
|
|
71
|
+
requireParameters?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Sort providers by price or throughput. (e.g. "price" or "throughput").
|
|
74
|
+
*
|
|
75
|
+
* @see {@link https://openrouter.ai/docs/features/provider-routing#provider-sorting}
|
|
76
|
+
* @example 'price'
|
|
77
|
+
*/
|
|
78
|
+
sort?: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* To help with prompts that exceed the maximum context size of a model.
|
|
82
|
+
*
|
|
83
|
+
* All OpenRouter endpoints with 8k or less context length will default to using middle-out.
|
|
84
|
+
* To disable this, set `transforms: []` in the request body.
|
|
85
|
+
*
|
|
86
|
+
* @see {@link https://openrouter.ai/docs/features/message-transforms}
|
|
87
|
+
* @default 'middle-out'
|
|
88
|
+
*/
|
|
89
|
+
transforms?: string[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create a OpenRouter Provider
|
|
93
|
+
* @see {@link https://openrouter.ai/models}
|
|
94
|
+
*/
|
|
95
|
+
declare const createOpenRouter: (apiKey: string, baseURL?: string) => ModelProvider & ChatProviderWithExtraOptions<OpenrouterModels, OpenRouterOptions>;
|
|
96
|
+
|
|
97
|
+
interface AnthropicOptions {
|
|
98
|
+
/** @see {@link https://docs.claude.com/en/api/openai-sdk#extended-thinking-support} */
|
|
99
|
+
thinking?: {
|
|
100
|
+
budget_tokens: number;
|
|
101
|
+
type: 'enabled';
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Create a Anthropic Provider
|
|
106
|
+
* @see {@link https://docs.claude.com/en/api/openai-sdk}
|
|
107
|
+
*/
|
|
108
|
+
declare const createAnthropic: (apiKey: string, baseURL?: string) => ModelProvider & ChatProviderWithExtraOptions<AnthropicModels, AnthropicOptions>;
|
|
109
|
+
|
|
110
|
+
export { createOpenRouter as a, createAnthropic as c };
|
|
111
|
+
export type { AnthropicOptions as A, OpenRouterOptions as O };
|