1{ lib }:
2
3lib.mkOption {
4 type = lib.types.submodule {
5 options = {
6 providers = lib.mkOption {
7 type = lib.types.attrsOf (
8 lib.types.submodule {
9 options = {
10 name = lib.mkOption {
11 type = lib.types.str;
12 description = "Provider display name";
13 };
14 type = lib.mkOption {
15 type = lib.types.str;
16 default = "openai";
17 description = "Provider type (openai, anthropic, etc.)";
18 };
19 base_url = lib.mkOption {
20 type = lib.types.str;
21 default = "";
22 description = "Provider API endpoint";
23 };
24 api_key = lib.mkOption {
25 type = lib.types.str;
26 default = "";
27 description = "Provider API key";
28 };
29 system_prompt_prefix = lib.mkOption {
30 type = lib.types.str;
31 default = "";
32 description = "prefix for the system prompt";
33 };
34 extra_headers = lib.mkOption {
35 type = lib.types.attrsOf lib.types.str;
36 default = { };
37 description = "Extra HTTP headers for the provider";
38 };
39 models = lib.mkOption {
40 type = lib.types.listOf (
41 lib.types.submodule {
42 options = {
43 id = lib.mkOption {
44 type = lib.types.str;
45 description = "Model ID";
46 };
47 model = lib.mkOption {
48 type = lib.types.str;
49 description = "Model display name";
50 };
51 cost_per_1m_in = lib.mkOption {
52 type = lib.types.int;
53 default = 0;
54 description = "Cost per 1M input tokens";
55 };
56 cost_per_1m_out = lib.mkOption {
57 type = lib.types.int;
58 default = 0;
59 description = "Cost per 1M output tokens";
60 };
61 cost_per_1m_in_cached = lib.mkOption {
62 type = lib.types.int;
63 default = 0;
64 description = "Cost per 1M cached input tokens";
65 };
66 cost_per_1m_out_cached = lib.mkOption {
67 type = lib.types.int;
68 default = 0;
69 description = "Cost per 1M cached output tokens";
70 };
71 context_window = lib.mkOption {
72 type = lib.types.int;
73 default = 128000;
74 description = "Model context window size";
75 };
76 default_max_tokens = lib.mkOption {
77 type = lib.types.int;
78 default = 8192;
79 description = "Default max tokens for responses";
80 };
81 can_reason = lib.mkOption {
82 type = lib.types.bool;
83 default = false;
84 description = "Whether the model can reason";
85 };
86 has_reasoning_efforts = lib.mkOption {
87 type = lib.types.bool;
88 default = false;
89 description = "Whether the model has reasoning efforts";
90 };
91 supports_attachments = lib.mkOption {
92 type = lib.types.bool;
93 default = false;
94 description = "Whether the model supports attachments";
95 };
96 };
97 }
98 );
99 default = [ ];
100 description = "Provider models configuration";
101 };
102 disable = lib.mkOption {
103 type = lib.types.bool;
104 default = false;
105 description = "Disable this provider";
106 };
107 };
108 }
109 );
110 default = { };
111 description = "Provider configurations";
112 };
113 lsp = lib.mkOption {
114 type = lib.types.attrsOf (
115 lib.types.submodule {
116 options = {
117 command = lib.mkOption {
118 type = lib.types.str;
119 description = "LSP command to execute";
120 };
121 args = lib.mkOption {
122 type = lib.types.listOf lib.types.str;
123 default = [ ];
124 description = "Arguments to pass to the LSP command";
125 };
126 disabled = lib.mkOption {
127 type = lib.types.bool;
128 default = false;
129 description = "Disable this LSP";
130 };
131 };
132 }
133 );
134 default = { };
135 description = "LSP configurations";
136 };
137 mcp = lib.mkOption {
138 type = lib.types.attrsOf (
139 lib.types.submodule {
140 options = {
141 type = lib.mkOption {
142 type = lib.types.str;
143 default = "http";
144 description = "MCP type (http, stdio, sse)";
145 };
146 url = lib.mkOption {
147 type = lib.types.str;
148 default = "";
149 description = "MCP URL for HTTP type";
150 };
151 command = lib.mkOption {
152 type = lib.types.str;
153 default = "";
154 description = "MCP command for stdio/sse type";
155 };
156 args = lib.mkOption {
157 type = lib.types.listOf lib.types.str;
158 default = [ ];
159 description = "Arguments for MCP command";
160 };
161 headers = lib.mkOption {
162 type = lib.types.attrsOf lib.types.str;
163 default = { };
164 description = "HTTP headers for MCP";
165 };
166 disabled = lib.mkOption {
167 type = lib.types.bool;
168 default = false;
169 description = "Disable this MCP";
170 };
171 };
172 }
173 );
174 default = { };
175 description = "MCP configurations";
176 };
177 options = lib.mkOption {
178 type = lib.types.submodule {
179 options = {
180 context_paths = lib.mkOption {
181 type = lib.types.listOf lib.types.str;
182 default = [ ];
183 description = "Additional context paths";
184 };
185 tui = lib.mkOption {
186 type = lib.types.submodule {
187 options = {
188 compact_mode = lib.mkOption {
189 type = lib.types.bool;
190 default = false;
191 description = "Enable compact mode in the TUI";
192 };
193 };
194 };
195 default = { };
196 description = "TUI options";
197 };
198 debug = lib.mkOption {
199 type = lib.types.bool;
200 default = false;
201 description = "Enable debug mode";
202 };
203 debug_lsp = lib.mkOption {
204 type = lib.types.bool;
205 default = false;
206 description = "Enable LSP debugging";
207 };
208 disable_auto_summarize = lib.mkOption {
209 type = lib.types.bool;
210 default = false;
211 description = "Disable automatic summarization";
212 };
213 data_directory = lib.mkOption {
214 type = lib.types.str;
215 default = ".crush";
216 description = "Data directory relative to working directory";
217 };
218 };
219 };
220 default = { };
221 description = "General options";
222 };
223 models = lib.mkOption {
224 type = lib.types.attrsOf (
225 lib.types.submodule {
226 options = {
227 model = lib.mkOption {
228 type = lib.types.str;
229 description = "Model ID as used by the provider API";
230 };
231 provider = lib.mkOption {
232 type = lib.types.str;
233 description = "Model provider ID";
234 };
235 reasoning_effort = lib.mkOption {
236 type = lib.types.str;
237 default = "";
238 description = "Reasoning effort for OpenAI models";
239 };
240 max_tokens = lib.mkOption {
241 type = lib.types.int;
242 default = 0;
243 description = "Override default max tokens";
244 };
245 think = lib.mkOption {
246 type = lib.types.bool;
247 default = false;
248 description = "Enable thinking for Anthropic models";
249 };
250 };
251 }
252 );
253 default = { };
254 description = "Model configurations";
255 };
256 };
257 };
258 default = { };
259 description = "Crush configuration options";
260}