-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathopenrouter-chat-settings.ts
More file actions
123 lines (111 loc) · 3.54 KB
/
openrouter-chat-settings.ts
File metadata and controls
123 lines (111 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import type { OpenRouterSharedSettings } from '..';
// https://openrouter.ai/api/v1/models
export type OpenRouterChatModelId = string;
export type OpenRouterChatSettings = {
/**
Modify the likelihood of specified tokens appearing in the completion.
Accepts a JSON object that maps tokens (specified by their token ID in
the GPT tokenizer) to an associated bias value from -100 to 100. You
can use this tokenizer tool to convert text to token IDs. Mathematically,
the bias is added to the logits generated by the model prior to sampling.
The exact effect will vary per model, but values between -1 and 1 should
decrease or increase likelihood of selection; values like -100 or 100
should result in a ban or exclusive selection of the relevant token.
As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
token from being generated.
*/
logitBias?: Record<number, number>;
/**
Return the log probabilities of the tokens. Including logprobs will increase
the response size and can slow down response times. However, it can
be useful to understand better how the model is behaving.
Setting to true will return the log probabilities of the tokens that
were generated.
Setting to a number will return the log probabilities of the top n
tokens that were generated.
*/
logprobs?: boolean | number;
/**
Whether to enable parallel function calling during tool use. Default to true.
*/
parallelToolCalls?: boolean;
/**
A unique identifier representing your end-user, which can help OpenRouter to
monitor and detect abuse. Learn more.
*/
user?: string;
/**
* Web search plugin configuration for enabling web search capabilities
*/
plugins?: Array<{
type: 'web';
/**
* Maximum number of search results to include (default: 5)
*/
max_results?: number;
/**
* Custom search prompt to guide the search query
*/
search_prompt?: string;
}>;
/**
* Built-in web search options for models that support native web search
*/
web_search_options?: {
/**
* Maximum number of search results to include
*/
max_results?: number;
/**
* Custom search prompt to guide the search query
*/
search_prompt?: string;
};
/**
* Provider routing preferences to control request routing behavior
*/
provider?: {
/**
* List of provider slugs to try in order (e.g. ["anthropic", "openai"])
*/
order?: string[];
/**
* Whether to allow backup providers when primary is unavailable (default: true)
*/
allow_fallbacks?: boolean;
/**
* Only use providers that support all parameters in your request (default: false)
*/
require_parameters?: boolean;
/**
* Control whether to use providers that may store data
*/
data_collection?: 'allow' | 'deny';
/**
* List of provider slugs to allow for this request
*/
only?: string[];
/**
* List of provider slugs to skip for this request
*/
ignore?: string[];
/**
* List of quantization levels to filter by (e.g. ["int4", "int8"])
*/
quantizations?: Array<'int4' | 'int8' | 'fp4' | 'fp6' | 'fp8' | 'fp16' | 'bf16' | 'fp32' | 'unknown'>;
/**
* Sort providers by price, throughput, or latency
*/
sort?: 'price' | 'throughput' | 'latency';
/**
* Maximum pricing you want to pay for this request
*/
max_price?: {
prompt?: number | string;
completion?: number | string;
image?: number | string;
audio?: number | string;
request?: number | string;
};
};
} & OpenRouterSharedSettings;