@johnowennixon/diffdash 1.6.0 → 1.7.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.
- package/README.md +5 -4
- package/dist/package.json +14 -22
- package/dist/src/lib_abort.js +2 -2
- package/dist/src/lib_assert_type.js +30 -0
- package/dist/src/lib_char_smart.js +4 -0
- package/dist/src/lib_debug.js +1 -0
- package/dist/src/lib_diffdash_cli.js +4 -2
- package/dist/src/lib_diffdash_config.js +32 -3
- package/dist/src/lib_diffdash_llm.js +1 -1
- package/dist/src/lib_diffdash_sequence.js +10 -13
- package/dist/src/lib_file_io.js +13 -0
- package/dist/src/lib_file_is.js +34 -0
- package/dist/src/lib_git_message_generate.js +1 -1
- package/dist/src/lib_git_message_prompt.js +25 -20
- package/dist/src/lib_json5.js +4 -0
- package/dist/src/lib_llm_access.js +28 -23
- package/dist/src/{lib_llm_provider.js → lib_llm_api.js} +29 -13
- package/dist/src/lib_llm_chat.js +42 -11
- package/dist/src/lib_llm_config.js +11 -11
- package/dist/src/lib_llm_list.js +1 -1
- package/dist/src/lib_llm_model.js +155 -74
- package/dist/src/lib_tell.js +5 -5
- package/dist/src/lib_tui_quote.js +26 -0
- package/dist/src/lib_type_guard.js +15 -0
- package/package.json +14 -22
package/dist/src/lib_llm_chat.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { generateObject, generateText } from "ai";
|
|
2
2
|
import { debug_channels, debug_inspect_when } from "./lib_debug.js";
|
|
3
|
+
import { Duration } from "./lib_duration.js";
|
|
3
4
|
import { env_get_empty, env_get_substitute } from "./lib_env.js";
|
|
4
|
-
import {
|
|
5
|
+
import { error_get_text } from "./lib_error.js";
|
|
6
|
+
import { llm_api_get_ai_sdk_language_model } from "./lib_llm_api.js";
|
|
5
7
|
import { parse_float_or_undefined, parse_int, parse_int_or_undefined } from "./lib_parse_number.js";
|
|
8
|
+
import { tell_debug } from "./lib_tell.js";
|
|
9
|
+
import { tui_block_string } from "./lib_tui_block.js";
|
|
6
10
|
function llm_chat_get_parameters() {
|
|
7
11
|
return {
|
|
8
12
|
max_tokens: parse_int_or_undefined(env_get_empty("lib_llm_chat_max_tokens")),
|
|
@@ -10,11 +14,21 @@ function llm_chat_get_parameters() {
|
|
|
10
14
|
timeout: parse_int(env_get_substitute("lib_llm_chat_timeout", "60")),
|
|
11
15
|
};
|
|
12
16
|
}
|
|
17
|
+
function llm_chat_debug_prompts({ llm_model_name, system_prompt, user_prompt, }) {
|
|
18
|
+
if (debug_channels.llm_prompts) {
|
|
19
|
+
const teller = tell_debug;
|
|
20
|
+
if (system_prompt) {
|
|
21
|
+
tui_block_string({ teller, title: `LLM system prompt (for ${llm_model_name}):`, content: system_prompt });
|
|
22
|
+
}
|
|
23
|
+
tui_block_string({ teller, title: `LLM user prompt (for ${llm_model_name}):`, content: user_prompt });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
13
26
|
export async function llm_chat_generate_text({ llm_config, headers, system_prompt, user_prompt, tools, max_steps, min_steps, }) {
|
|
14
|
-
const { llm_model_name,
|
|
15
|
-
|
|
27
|
+
const { llm_model_name, llm_api_code, llm_model_code, llm_api_key } = llm_config;
|
|
28
|
+
llm_chat_debug_prompts({ system_prompt, user_prompt, llm_model_name });
|
|
29
|
+
const ai_sdk_language_model = llm_api_get_ai_sdk_language_model({
|
|
16
30
|
llm_model_code,
|
|
17
|
-
|
|
31
|
+
llm_api_code,
|
|
18
32
|
llm_api_key,
|
|
19
33
|
});
|
|
20
34
|
const { max_tokens, temperature, timeout } = llm_chat_get_parameters();
|
|
@@ -29,10 +43,10 @@ export async function llm_chat_generate_text({ llm_config, headers, system_promp
|
|
|
29
43
|
temperature,
|
|
30
44
|
abortSignal: AbortSignal.timeout(timeout * 1000),
|
|
31
45
|
};
|
|
32
|
-
debug_inspect_when(debug_channels.llm_inputs, llm_inputs, `
|
|
46
|
+
debug_inspect_when(debug_channels.llm_inputs, llm_inputs, `LLM inputs object (for ${llm_model_name})`);
|
|
33
47
|
// This is liable to throw an error
|
|
34
48
|
const llm_outputs = await generateText(llm_inputs);
|
|
35
|
-
debug_inspect_when(debug_channels.llm_outputs, llm_outputs, `
|
|
49
|
+
debug_inspect_when(debug_channels.llm_outputs, llm_outputs, `LLM outputs object (for ${llm_model_name})`);
|
|
36
50
|
if (min_steps !== undefined && llm_outputs.steps.length < min_steps) {
|
|
37
51
|
throw new Error("Too few steps taken");
|
|
38
52
|
}
|
|
@@ -41,11 +55,28 @@ export async function llm_chat_generate_text({ llm_config, headers, system_promp
|
|
|
41
55
|
}
|
|
42
56
|
return llm_outputs.text;
|
|
43
57
|
}
|
|
58
|
+
export async function llm_chat_generate_result({ llm_config, system_prompt, user_prompt, }) {
|
|
59
|
+
const duration = new Duration();
|
|
60
|
+
duration.start();
|
|
61
|
+
try {
|
|
62
|
+
const llm_response_text = await llm_chat_generate_text({ llm_config, system_prompt, user_prompt });
|
|
63
|
+
duration.stop();
|
|
64
|
+
const seconds = duration.seconds_rounded();
|
|
65
|
+
return { llm_config, seconds, llm_response_text, error_text: null };
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
duration.stop();
|
|
69
|
+
const seconds = duration.seconds_rounded();
|
|
70
|
+
const error_text = error_get_text(error);
|
|
71
|
+
return { llm_config, seconds, llm_response_text: null, error_text };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
44
74
|
export async function llm_chat_generate_object({ llm_config, user_prompt, system_prompt, schema, }) {
|
|
45
|
-
const { llm_model_name,
|
|
46
|
-
|
|
75
|
+
const { llm_model_name, llm_api_code, llm_model_code, llm_api_key } = llm_config;
|
|
76
|
+
llm_chat_debug_prompts({ system_prompt, user_prompt, llm_model_name });
|
|
77
|
+
const ai_sdk_language_model = llm_api_get_ai_sdk_language_model({
|
|
47
78
|
llm_model_code,
|
|
48
|
-
|
|
79
|
+
llm_api_code,
|
|
49
80
|
llm_api_key,
|
|
50
81
|
});
|
|
51
82
|
const { max_tokens, temperature, timeout } = llm_chat_get_parameters();
|
|
@@ -58,9 +89,9 @@ export async function llm_chat_generate_object({ llm_config, user_prompt, system
|
|
|
58
89
|
temperature,
|
|
59
90
|
abortSignal: AbortSignal.timeout(timeout * 1000),
|
|
60
91
|
};
|
|
61
|
-
debug_inspect_when(debug_channels.llm_inputs, llm_inputs, `
|
|
92
|
+
debug_inspect_when(debug_channels.llm_inputs, llm_inputs, `LLM inputs object (for ${llm_model_name})`);
|
|
62
93
|
// This is liable to throw an error
|
|
63
94
|
const llm_outputs = await generateObject(llm_inputs);
|
|
64
|
-
debug_inspect_when(debug_channels.llm_outputs, llm_outputs, `
|
|
95
|
+
debug_inspect_when(debug_channels.llm_outputs, llm_outputs, `LLM outputs object (for ${llm_model_name})`);
|
|
65
96
|
return llm_outputs.object;
|
|
66
97
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { llm_access_available, llm_access_get } from "./lib_llm_access.js";
|
|
2
|
+
import { llm_api_get_via } from "./lib_llm_api.js";
|
|
2
3
|
import { llm_model_find_detail, llm_model_get_choices } from "./lib_llm_model.js";
|
|
3
|
-
import { llm_provider_get_via } from "./lib_llm_provider.js";
|
|
4
4
|
import { tell_info } from "./lib_tell.js";
|
|
5
5
|
export function llm_config_get({ llm_model_details, llm_model_name, llm_router, }) {
|
|
6
6
|
const llm_model_detail = llm_model_find_detail({ llm_model_details, llm_model_name });
|
|
7
7
|
const access = llm_access_get({ llm_model_details, llm_model_name, llm_router });
|
|
8
|
-
const { llm_model_code,
|
|
9
|
-
return { llm_model_name, llm_model_detail, llm_model_code,
|
|
8
|
+
const { llm_model_code, llm_api_code, llm_api_key } = access;
|
|
9
|
+
return { llm_model_name, llm_model_detail, llm_model_code, llm_api_code, llm_api_key };
|
|
10
10
|
}
|
|
11
|
-
export function llm_config_get_all({ llm_model_details, llm_router, llm_excludes, }) {
|
|
12
|
-
const choices = llm_model_get_choices(llm_model_details);
|
|
13
|
-
const available = choices.filter((llm_model_name) => llm_access_available({ llm_model_details, llm_model_name, llm_excludes }));
|
|
11
|
+
export function llm_config_get_all({ llm_model_details, llm_router, llm_include, llm_excludes, }) {
|
|
12
|
+
const choices = llm_model_get_choices({ llm_model_details });
|
|
13
|
+
const available = choices.filter((llm_model_name) => llm_access_available({ llm_model_details, llm_model_name, llm_include, llm_excludes }));
|
|
14
14
|
return available.map((llm_model_name) => llm_config_get({ llm_model_details, llm_model_name, llm_router }));
|
|
15
15
|
}
|
|
16
|
-
export function llm_config_get_model_via(llm_config) {
|
|
17
|
-
const { llm_model_name,
|
|
18
|
-
return `${llm_model_name} (${
|
|
16
|
+
export function llm_config_get_model_via({ llm_config }) {
|
|
17
|
+
const { llm_model_name, llm_api_code } = llm_config;
|
|
18
|
+
return `${llm_model_name} (${llm_api_get_via(llm_api_code)})`;
|
|
19
19
|
}
|
|
20
|
-
export function llm_config_show(llm_config) {
|
|
21
|
-
const model_via = llm_config_get_model_via(llm_config);
|
|
20
|
+
export function llm_config_show({ llm_config }) {
|
|
21
|
+
const model_via = llm_config_get_model_via({ llm_config });
|
|
22
22
|
tell_info(`Using LLM ${model_via}`);
|
|
23
23
|
}
|
package/dist/src/lib_llm_list.js
CHANGED
|
@@ -17,5 +17,5 @@ export function llm_list_models({ llm_model_details }) {
|
|
|
17
17
|
}
|
|
18
18
|
stdio_write_stdout_linefeed(table.toString());
|
|
19
19
|
tell_info("Prices are per million tokens.");
|
|
20
|
-
tell_warning("Prices are best effort and are liable to change - always double-check with your LLM provider.");
|
|
20
|
+
tell_warning("Prices are best effort and are liable to change - always double-check with your LLM API provider.");
|
|
21
21
|
}
|
|
@@ -2,372 +2,453 @@ import { abort_with_error } from "./lib_abort.js";
|
|
|
2
2
|
const LLM_MODEL_DETAILS = [
|
|
3
3
|
{
|
|
4
4
|
llm_model_name: "claude-3.5-haiku",
|
|
5
|
-
|
|
5
|
+
llm_api_code: "anthropic",
|
|
6
6
|
llm_model_code_direct: "claude-3-5-haiku-latest",
|
|
7
7
|
llm_model_code_requesty: "anthropic/claude-3-5-haiku-latest",
|
|
8
8
|
llm_model_code_openrouter: "anthropic/claude-3.5-haiku",
|
|
9
9
|
context_window: 200_000,
|
|
10
10
|
cents_input: 80,
|
|
11
11
|
cents_output: 400,
|
|
12
|
+
default_reasoning: false,
|
|
12
13
|
has_structured_json: true,
|
|
13
14
|
},
|
|
14
15
|
{
|
|
15
16
|
llm_model_name: "claude-3.7-sonnet",
|
|
16
|
-
|
|
17
|
+
llm_api_code: "anthropic",
|
|
17
18
|
llm_model_code_direct: "claude-3-7-sonnet-20250219",
|
|
18
19
|
llm_model_code_requesty: "anthropic/claude-3-7-sonnet-latest",
|
|
19
20
|
llm_model_code_openrouter: "anthropic/claude-3.7-sonnet",
|
|
20
21
|
context_window: 200_000,
|
|
21
22
|
cents_input: 300,
|
|
22
23
|
cents_output: 1500,
|
|
24
|
+
default_reasoning: false,
|
|
23
25
|
has_structured_json: true,
|
|
24
26
|
},
|
|
25
27
|
{
|
|
26
28
|
llm_model_name: "claude-sonnet-4",
|
|
27
|
-
|
|
29
|
+
llm_api_code: "anthropic",
|
|
28
30
|
llm_model_code_direct: "claude-sonnet-4-0",
|
|
29
31
|
llm_model_code_requesty: "anthropic/claude-sonnet-4-20250514",
|
|
30
32
|
llm_model_code_openrouter: "anthropic/claude-sonnet-4",
|
|
31
33
|
context_window: 200_000,
|
|
32
34
|
cents_input: 300,
|
|
33
35
|
cents_output: 1500,
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
llm_model_name: "codex-mini",
|
|
38
|
-
llm_provider: "openai",
|
|
39
|
-
llm_model_code_direct: "codex-mini-latest",
|
|
40
|
-
llm_model_code_requesty: null,
|
|
41
|
-
llm_model_code_openrouter: "openai/codex-mini",
|
|
42
|
-
context_window: 200_000,
|
|
43
|
-
cents_input: 150,
|
|
44
|
-
cents_output: 600,
|
|
36
|
+
default_reasoning: false,
|
|
45
37
|
has_structured_json: true,
|
|
46
38
|
},
|
|
47
39
|
{
|
|
48
40
|
llm_model_name: "deepseek-v3",
|
|
49
|
-
|
|
41
|
+
llm_api_code: "deepseek",
|
|
50
42
|
llm_model_code_direct: "deepseek-chat",
|
|
51
43
|
llm_model_code_requesty: "novita/deepseek/deepseek-v3-0324",
|
|
52
44
|
llm_model_code_openrouter: "deepseek/deepseek-chat-v3-0324",
|
|
53
45
|
context_window: 64_000,
|
|
54
46
|
cents_input: 27,
|
|
55
47
|
cents_output: 110,
|
|
48
|
+
default_reasoning: false,
|
|
56
49
|
has_structured_json: true,
|
|
57
50
|
},
|
|
58
51
|
{
|
|
59
52
|
llm_model_name: "deepseek-r1",
|
|
60
|
-
|
|
53
|
+
llm_api_code: "deepseek",
|
|
61
54
|
llm_model_code_direct: "deepseek-reasoner",
|
|
62
55
|
llm_model_code_requesty: "netmind/deepseek-ai/DeepSeek-R1-0528",
|
|
63
56
|
llm_model_code_openrouter: "deepseek/deepseek-r1-0528",
|
|
64
57
|
context_window: 163_840,
|
|
65
58
|
cents_input: 55,
|
|
66
59
|
cents_output: 219,
|
|
60
|
+
default_reasoning: true,
|
|
67
61
|
has_structured_json: true,
|
|
68
62
|
},
|
|
69
63
|
{
|
|
70
64
|
llm_model_name: "devstral-medium",
|
|
71
|
-
|
|
65
|
+
llm_api_code: null,
|
|
72
66
|
llm_model_code_direct: "devstral-medium-latest",
|
|
73
67
|
llm_model_code_requesty: "mistral/devstral-medium-latest",
|
|
74
68
|
llm_model_code_openrouter: "mistralai/devstral-medium",
|
|
75
69
|
context_window: 128_000,
|
|
76
70
|
cents_input: 40,
|
|
77
71
|
cents_output: 200,
|
|
72
|
+
default_reasoning: false,
|
|
78
73
|
has_structured_json: true,
|
|
79
74
|
},
|
|
80
75
|
{
|
|
81
76
|
llm_model_name: "devstral-small",
|
|
82
|
-
|
|
77
|
+
llm_api_code: null,
|
|
83
78
|
llm_model_code_direct: "devstral-small-latest",
|
|
84
79
|
llm_model_code_requesty: "mistral/devstral-small-latest",
|
|
85
80
|
llm_model_code_openrouter: "mistralai/devstral-small",
|
|
86
81
|
context_window: 128_000,
|
|
87
82
|
cents_input: 10,
|
|
88
83
|
cents_output: 30,
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
llm_model_name: "ernie-4.5-300b",
|
|
93
|
-
llm_provider: null,
|
|
94
|
-
llm_model_code_direct: null,
|
|
95
|
-
llm_model_code_requesty: null,
|
|
96
|
-
llm_model_code_openrouter: "baidu/ernie-4.5-300b-a47b",
|
|
97
|
-
context_window: 123_000,
|
|
98
|
-
cents_input: 30,
|
|
99
|
-
cents_output: 100,
|
|
84
|
+
default_reasoning: false,
|
|
100
85
|
has_structured_json: true,
|
|
101
86
|
},
|
|
102
87
|
{
|
|
103
88
|
llm_model_name: "gemini-2.0-flash",
|
|
104
|
-
|
|
89
|
+
llm_api_code: "google",
|
|
105
90
|
llm_model_code_direct: "gemini-2.0-flash",
|
|
106
91
|
llm_model_code_requesty: "google/gemini-2.0-flash-001",
|
|
107
92
|
llm_model_code_openrouter: "google/gemini-2.0-flash-001",
|
|
108
93
|
context_window: 1_048_576,
|
|
109
94
|
cents_input: 10,
|
|
110
95
|
cents_output: 40,
|
|
96
|
+
default_reasoning: false,
|
|
111
97
|
has_structured_json: true,
|
|
112
98
|
},
|
|
113
99
|
{
|
|
114
100
|
llm_model_name: "gemini-2.5-flash",
|
|
115
|
-
|
|
101
|
+
llm_api_code: "google",
|
|
116
102
|
llm_model_code_direct: "gemini-2.5-flash",
|
|
117
103
|
llm_model_code_requesty: "google/gemini-2.5-flash",
|
|
118
104
|
llm_model_code_openrouter: "google/gemini-2.5-flash",
|
|
119
105
|
context_window: 1_048_576,
|
|
120
106
|
cents_input: 30,
|
|
121
107
|
cents_output: 250,
|
|
108
|
+
default_reasoning: false,
|
|
122
109
|
has_structured_json: true,
|
|
123
110
|
},
|
|
124
111
|
{
|
|
125
112
|
llm_model_name: "gemini-2.5-pro",
|
|
126
|
-
|
|
113
|
+
llm_api_code: "google",
|
|
127
114
|
llm_model_code_direct: "gemini-2.5-pro",
|
|
128
115
|
llm_model_code_requesty: "google/gemini-2.5-pro",
|
|
129
116
|
llm_model_code_openrouter: "google/gemini-2.5-pro",
|
|
130
117
|
context_window: 1_048_576,
|
|
131
118
|
cents_input: 125,
|
|
132
119
|
cents_output: 1000,
|
|
120
|
+
default_reasoning: false,
|
|
133
121
|
has_structured_json: true,
|
|
134
122
|
},
|
|
135
123
|
{
|
|
136
124
|
llm_model_name: "glm-4-32b",
|
|
137
|
-
|
|
125
|
+
llm_api_code: null,
|
|
138
126
|
llm_model_code_direct: null,
|
|
139
127
|
llm_model_code_requesty: null,
|
|
140
|
-
llm_model_code_openrouter: "
|
|
141
|
-
context_window:
|
|
142
|
-
cents_input:
|
|
143
|
-
cents_output:
|
|
128
|
+
llm_model_code_openrouter: "z-ai/glm-4-32b",
|
|
129
|
+
context_window: 128_000,
|
|
130
|
+
cents_input: 10,
|
|
131
|
+
cents_output: 10,
|
|
132
|
+
default_reasoning: false,
|
|
144
133
|
has_structured_json: false,
|
|
145
134
|
},
|
|
146
135
|
{
|
|
147
136
|
llm_model_name: "gpt-4.1",
|
|
148
|
-
|
|
137
|
+
llm_api_code: "openai",
|
|
149
138
|
llm_model_code_direct: "gpt-4.1",
|
|
150
139
|
llm_model_code_requesty: "openai/gpt-4.1",
|
|
151
140
|
llm_model_code_openrouter: "openai/gpt-4.1",
|
|
152
141
|
context_window: 1_047_576,
|
|
153
142
|
cents_input: 200,
|
|
154
143
|
cents_output: 800,
|
|
144
|
+
default_reasoning: false,
|
|
155
145
|
has_structured_json: true,
|
|
156
146
|
},
|
|
157
147
|
{
|
|
158
148
|
llm_model_name: "gpt-4.1-mini",
|
|
159
|
-
|
|
149
|
+
llm_api_code: "openai",
|
|
160
150
|
llm_model_code_direct: "gpt-4.1-mini",
|
|
161
151
|
llm_model_code_requesty: "openai/gpt-4.1-mini",
|
|
162
152
|
llm_model_code_openrouter: "openai/gpt-4.1-mini",
|
|
163
153
|
context_window: 1_047_576,
|
|
164
154
|
cents_input: 40,
|
|
165
155
|
cents_output: 160,
|
|
156
|
+
default_reasoning: false,
|
|
166
157
|
has_structured_json: true,
|
|
167
158
|
},
|
|
168
159
|
{
|
|
169
160
|
llm_model_name: "gpt-4.1-nano",
|
|
170
|
-
|
|
161
|
+
llm_api_code: "openai",
|
|
171
162
|
llm_model_code_direct: "gpt-4.1-nano",
|
|
172
163
|
llm_model_code_requesty: "openai/gpt-4.1-nano",
|
|
173
164
|
llm_model_code_openrouter: "openai/gpt-4.1-nano",
|
|
174
165
|
context_window: 1_047_576,
|
|
175
166
|
cents_input: 10,
|
|
176
167
|
cents_output: 40,
|
|
168
|
+
default_reasoning: false,
|
|
177
169
|
has_structured_json: true,
|
|
178
170
|
},
|
|
179
171
|
{
|
|
180
172
|
llm_model_name: "gpt-4o",
|
|
181
|
-
|
|
173
|
+
llm_api_code: "openai",
|
|
182
174
|
llm_model_code_direct: "gpt-4o-2024-11-20",
|
|
183
175
|
llm_model_code_requesty: "openai/gpt-4o-2024-11-20",
|
|
184
176
|
llm_model_code_openrouter: "openai/gpt-4o-2024-11-20",
|
|
185
177
|
context_window: 128_000,
|
|
186
178
|
cents_input: 250,
|
|
187
179
|
cents_output: 1000,
|
|
180
|
+
default_reasoning: false,
|
|
188
181
|
has_structured_json: true,
|
|
189
182
|
},
|
|
190
183
|
{
|
|
191
184
|
llm_model_name: "gpt-4o-mini",
|
|
192
|
-
|
|
185
|
+
llm_api_code: "openai",
|
|
193
186
|
llm_model_code_direct: "gpt-4o-mini",
|
|
194
187
|
llm_model_code_requesty: "openai/gpt-4o-mini-2024-07-18",
|
|
195
188
|
llm_model_code_openrouter: "openai/gpt-4o-mini-2024-07-18",
|
|
196
189
|
context_window: 128_000,
|
|
197
190
|
cents_input: 15,
|
|
198
191
|
cents_output: 60,
|
|
192
|
+
default_reasoning: false,
|
|
199
193
|
has_structured_json: true,
|
|
200
194
|
},
|
|
201
195
|
{
|
|
202
196
|
llm_model_name: "grok-3",
|
|
203
|
-
|
|
197
|
+
llm_api_code: null,
|
|
204
198
|
llm_model_code_direct: "grok-3",
|
|
205
199
|
llm_model_code_requesty: "xai/grok-3-beta",
|
|
206
200
|
llm_model_code_openrouter: "x-ai/grok-3",
|
|
207
201
|
context_window: 131_072,
|
|
208
202
|
cents_input: 300,
|
|
209
203
|
cents_output: 1500,
|
|
204
|
+
default_reasoning: false,
|
|
210
205
|
has_structured_json: true,
|
|
211
206
|
},
|
|
212
207
|
{
|
|
213
208
|
llm_model_name: "grok-3-mini",
|
|
214
|
-
|
|
209
|
+
llm_api_code: null,
|
|
215
210
|
llm_model_code_direct: "grok-3-mini",
|
|
216
211
|
llm_model_code_requesty: "xai/grok-3-mini-beta",
|
|
217
212
|
llm_model_code_openrouter: "x-ai/grok-3-mini",
|
|
218
213
|
context_window: 131_072,
|
|
219
214
|
cents_input: 30,
|
|
220
215
|
cents_output: 50,
|
|
216
|
+
default_reasoning: false,
|
|
221
217
|
has_structured_json: true,
|
|
222
218
|
},
|
|
223
219
|
{
|
|
224
220
|
llm_model_name: "grok-4",
|
|
225
|
-
|
|
221
|
+
llm_api_code: null,
|
|
226
222
|
llm_model_code_direct: "grok-4",
|
|
227
223
|
llm_model_code_requesty: "xai/grok-4",
|
|
228
224
|
llm_model_code_openrouter: "x-ai/grok-4",
|
|
229
225
|
context_window: 256_000,
|
|
230
226
|
cents_input: 300,
|
|
231
227
|
cents_output: 1500,
|
|
228
|
+
default_reasoning: true,
|
|
232
229
|
has_structured_json: true,
|
|
233
230
|
},
|
|
234
231
|
{
|
|
235
232
|
llm_model_name: "kimi-k2",
|
|
236
|
-
|
|
233
|
+
llm_api_code: null,
|
|
237
234
|
llm_model_code_direct: "kimi-k2-0711-preview",
|
|
238
|
-
llm_model_code_requesty: null
|
|
235
|
+
llm_model_code_requesty: null,
|
|
239
236
|
llm_model_code_openrouter: "moonshotai/kimi-k2",
|
|
240
237
|
context_window: 131_072,
|
|
241
238
|
cents_input: 60,
|
|
242
239
|
cents_output: 250,
|
|
240
|
+
default_reasoning: false,
|
|
241
|
+
has_structured_json: true,
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
llm_model_name: "kimi-k2@chutes",
|
|
245
|
+
llm_api_code: null,
|
|
246
|
+
llm_model_code_direct: null,
|
|
247
|
+
llm_model_code_requesty: null,
|
|
248
|
+
llm_model_code_openrouter: "moonshotai/kimi-k2@chutes",
|
|
249
|
+
context_window: 131_072,
|
|
250
|
+
cents_input: 30,
|
|
251
|
+
cents_output: 30,
|
|
252
|
+
default_reasoning: false,
|
|
253
|
+
has_structured_json: true,
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
llm_model_name: "kimi-k2@groq",
|
|
257
|
+
llm_api_code: null,
|
|
258
|
+
llm_model_code_direct: null,
|
|
259
|
+
llm_model_code_requesty: null,
|
|
260
|
+
llm_model_code_openrouter: "moonshotai/kimi-k2@groq",
|
|
261
|
+
context_window: 131_072,
|
|
262
|
+
cents_input: 100,
|
|
263
|
+
cents_output: 300,
|
|
264
|
+
default_reasoning: false,
|
|
265
|
+
has_structured_json: true,
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
llm_model_name: "kimi-k2@moonshotai",
|
|
269
|
+
llm_api_code: null,
|
|
270
|
+
llm_model_code_direct: "kimi-k2-0711-preview",
|
|
271
|
+
llm_model_code_requesty: null,
|
|
272
|
+
llm_model_code_openrouter: "moonshotai/kimi-k2@moonshotai",
|
|
273
|
+
context_window: 131_072,
|
|
274
|
+
cents_input: 60,
|
|
275
|
+
cents_output: 250,
|
|
276
|
+
default_reasoning: false,
|
|
243
277
|
has_structured_json: true,
|
|
244
278
|
},
|
|
245
279
|
{
|
|
246
280
|
llm_model_name: "llama-4-maverick",
|
|
247
|
-
|
|
281
|
+
llm_api_code: null,
|
|
248
282
|
llm_model_code_direct: null,
|
|
249
283
|
llm_model_code_requesty: "parasail/meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",
|
|
250
284
|
llm_model_code_openrouter: "meta-llama/llama-4-maverick",
|
|
251
285
|
context_window: 1_048_576,
|
|
252
286
|
cents_input: 15,
|
|
253
287
|
cents_output: 60,
|
|
288
|
+
default_reasoning: false,
|
|
254
289
|
has_structured_json: true,
|
|
255
290
|
},
|
|
256
291
|
{
|
|
257
292
|
llm_model_name: "llama-4-scout",
|
|
258
|
-
|
|
293
|
+
llm_api_code: null,
|
|
259
294
|
llm_model_code_direct: null,
|
|
260
295
|
llm_model_code_requesty: "parasail/meta-llama/Llama-4-Scout-17B-16E-Instruct",
|
|
261
296
|
llm_model_code_openrouter: "meta-llama/llama-4-scout",
|
|
262
297
|
context_window: 1_048_576,
|
|
263
298
|
cents_input: 14,
|
|
264
299
|
cents_output: 58,
|
|
300
|
+
default_reasoning: false,
|
|
265
301
|
has_structured_json: true,
|
|
266
302
|
},
|
|
267
303
|
{
|
|
268
304
|
llm_model_name: "mercury",
|
|
269
|
-
|
|
305
|
+
llm_api_code: null,
|
|
270
306
|
llm_model_code_direct: null,
|
|
271
307
|
llm_model_code_requesty: null,
|
|
272
308
|
llm_model_code_openrouter: "inception/mercury",
|
|
273
309
|
context_window: 32_000,
|
|
274
310
|
cents_input: 25,
|
|
275
311
|
cents_output: 100,
|
|
312
|
+
default_reasoning: false,
|
|
276
313
|
has_structured_json: false,
|
|
277
314
|
},
|
|
278
315
|
{
|
|
279
316
|
llm_model_name: "mercury-coder",
|
|
280
|
-
|
|
317
|
+
llm_api_code: null,
|
|
281
318
|
llm_model_code_direct: null,
|
|
282
319
|
llm_model_code_requesty: null,
|
|
283
320
|
llm_model_code_openrouter: "inception/mercury-coder-small-beta",
|
|
284
321
|
context_window: 32_000,
|
|
285
322
|
cents_input: 25,
|
|
286
323
|
cents_output: 100,
|
|
324
|
+
default_reasoning: false,
|
|
287
325
|
has_structured_json: false,
|
|
288
326
|
},
|
|
289
327
|
{
|
|
290
328
|
llm_model_name: "mistral-medium-3",
|
|
291
|
-
|
|
329
|
+
llm_api_code: null,
|
|
292
330
|
llm_model_code_direct: null,
|
|
293
331
|
llm_model_code_requesty: null,
|
|
294
332
|
llm_model_code_openrouter: "mistralai/mistral-medium-3",
|
|
295
333
|
context_window: 131_072,
|
|
296
334
|
cents_input: 40,
|
|
297
335
|
cents_output: 200,
|
|
336
|
+
default_reasoning: false,
|
|
298
337
|
has_structured_json: true,
|
|
299
338
|
},
|
|
300
339
|
{
|
|
301
340
|
llm_model_name: "o3",
|
|
302
|
-
|
|
303
|
-
llm_model_code_direct: "o3
|
|
304
|
-
llm_model_code_requesty: "openai/o3
|
|
305
|
-
llm_model_code_openrouter: "openai/o3
|
|
341
|
+
llm_api_code: "openai",
|
|
342
|
+
llm_model_code_direct: "o3", // Your organization needs to be verified
|
|
343
|
+
llm_model_code_requesty: "openai/o3", // You need your own OpenAI key
|
|
344
|
+
llm_model_code_openrouter: "openai/o3", // You need your own OpenAI key
|
|
306
345
|
context_window: 200_000,
|
|
307
346
|
cents_input: 200,
|
|
308
347
|
cents_output: 800,
|
|
348
|
+
default_reasoning: true,
|
|
309
349
|
has_structured_json: true,
|
|
310
350
|
},
|
|
311
351
|
{
|
|
312
352
|
llm_model_name: "o3-pro",
|
|
313
|
-
|
|
314
|
-
llm_model_code_direct: "o3-pro",
|
|
315
|
-
llm_model_code_requesty: "openai/o3-pro",
|
|
316
|
-
llm_model_code_openrouter: "openai/o3-pro",
|
|
353
|
+
llm_api_code: "openai",
|
|
354
|
+
llm_model_code_direct: "o3-pro", // Your organization needs to be verified
|
|
355
|
+
llm_model_code_requesty: "openai/o3-pro", // You need your own OpenAI key
|
|
356
|
+
llm_model_code_openrouter: "openai/o3-pro", // You need your own OpenAI key
|
|
317
357
|
context_window: 200_000,
|
|
318
358
|
cents_input: 2000,
|
|
319
359
|
cents_output: 8000,
|
|
360
|
+
default_reasoning: true,
|
|
320
361
|
has_structured_json: true,
|
|
321
362
|
},
|
|
322
363
|
{
|
|
323
364
|
llm_model_name: "o4-mini",
|
|
324
|
-
|
|
325
|
-
llm_model_code_direct: "o4-mini
|
|
326
|
-
llm_model_code_requesty: "openai/o4-mini
|
|
327
|
-
llm_model_code_openrouter: "openai/o4-mini
|
|
365
|
+
llm_api_code: "openai",
|
|
366
|
+
llm_model_code_direct: "o4-mini",
|
|
367
|
+
llm_model_code_requesty: "openai/o4-mini",
|
|
368
|
+
llm_model_code_openrouter: "openai/o4-mini",
|
|
328
369
|
context_window: 200_000,
|
|
329
370
|
cents_input: 110,
|
|
330
371
|
cents_output: 440,
|
|
372
|
+
default_reasoning: true,
|
|
373
|
+
has_structured_json: true,
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
llm_model_name: "qwen3-235b-a22b",
|
|
377
|
+
llm_api_code: null,
|
|
378
|
+
llm_model_code_direct: null,
|
|
379
|
+
llm_model_code_requesty: "deepinfra/Qwen/Qwen3-235B-A22B",
|
|
380
|
+
llm_model_code_openrouter: "qwen/qwen3-235b-a22b",
|
|
381
|
+
context_window: 40_000,
|
|
382
|
+
cents_input: 20,
|
|
383
|
+
cents_output: 60,
|
|
384
|
+
default_reasoning: true,
|
|
385
|
+
has_structured_json: true,
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
llm_model_name: "qwen3-235b-a22b-2507",
|
|
389
|
+
llm_api_code: null,
|
|
390
|
+
llm_model_code_direct: null,
|
|
391
|
+
llm_model_code_requesty: null,
|
|
392
|
+
llm_model_code_openrouter: "qwen/qwen3-235b-a22b-07-25",
|
|
393
|
+
context_window: 262_144,
|
|
394
|
+
cents_input: 12,
|
|
395
|
+
cents_output: 59,
|
|
396
|
+
default_reasoning: true,
|
|
331
397
|
has_structured_json: true,
|
|
332
398
|
},
|
|
333
399
|
{
|
|
334
400
|
llm_model_name: "qwen3-30b-a3b",
|
|
335
|
-
|
|
401
|
+
llm_api_code: null,
|
|
336
402
|
llm_model_code_direct: null,
|
|
337
403
|
llm_model_code_requesty: null,
|
|
338
404
|
llm_model_code_openrouter: "qwen/qwen3-30b-a3b",
|
|
339
405
|
context_window: 40_000,
|
|
340
406
|
cents_input: 8,
|
|
341
407
|
cents_output: 29,
|
|
408
|
+
default_reasoning: true,
|
|
342
409
|
has_structured_json: true,
|
|
343
410
|
},
|
|
344
411
|
{
|
|
345
412
|
llm_model_name: "qwen3-32b",
|
|
346
|
-
|
|
413
|
+
llm_api_code: null,
|
|
347
414
|
llm_model_code_direct: null,
|
|
348
415
|
llm_model_code_requesty: "deepinfra/Qwen/Qwen3-32B",
|
|
349
416
|
llm_model_code_openrouter: "qwen/qwen3-32b",
|
|
350
417
|
context_window: 40_000,
|
|
351
418
|
cents_input: 10,
|
|
352
419
|
cents_output: 30,
|
|
420
|
+
default_reasoning: true,
|
|
353
421
|
has_structured_json: true,
|
|
354
422
|
},
|
|
355
423
|
{
|
|
356
|
-
llm_model_name: "qwen3-
|
|
357
|
-
|
|
424
|
+
llm_model_name: "qwen3-coder",
|
|
425
|
+
llm_api_code: null,
|
|
426
|
+
llm_model_code_direct: "Qwen3-Coder-480B-A35B-Instruct",
|
|
427
|
+
llm_model_code_requesty: null,
|
|
428
|
+
llm_model_code_openrouter: "qwen/qwen3-coder",
|
|
429
|
+
context_window: 262_144,
|
|
430
|
+
cents_input: 150,
|
|
431
|
+
cents_output: 750,
|
|
432
|
+
default_reasoning: false,
|
|
433
|
+
has_structured_json: true,
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
llm_model_name: "qwen3-coder@chutes",
|
|
437
|
+
llm_api_code: null,
|
|
358
438
|
llm_model_code_direct: null,
|
|
359
|
-
llm_model_code_requesty:
|
|
360
|
-
llm_model_code_openrouter: "qwen/qwen3-
|
|
361
|
-
context_window:
|
|
362
|
-
cents_input:
|
|
363
|
-
cents_output:
|
|
439
|
+
llm_model_code_requesty: null,
|
|
440
|
+
llm_model_code_openrouter: "qwen/qwen3-coder@chutes",
|
|
441
|
+
context_window: 262_144,
|
|
442
|
+
cents_input: 30,
|
|
443
|
+
cents_output: 30,
|
|
444
|
+
default_reasoning: false,
|
|
364
445
|
has_structured_json: true,
|
|
365
446
|
},
|
|
366
447
|
];
|
|
367
448
|
export function llm_model_get_details({ llm_model_names, }) {
|
|
368
449
|
return LLM_MODEL_DETAILS.filter((detail) => llm_model_names.includes(detail.llm_model_name));
|
|
369
450
|
}
|
|
370
|
-
export function llm_model_get_choices(llm_model_details) {
|
|
451
|
+
export function llm_model_get_choices({ llm_model_details }) {
|
|
371
452
|
return llm_model_details.map((model) => model.llm_model_name);
|
|
372
453
|
}
|
|
373
454
|
export function llm_model_find_detail({ llm_model_details, llm_model_name, }) {
|