@tyvm/knowhow 0.0.68 → 0.0.70
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/docs/shell-commands.md +174 -0
- package/package.json +2 -2
- package/src/agents/base/base.ts +1 -3
- package/src/agents/developer/developer.ts +21 -16
- package/src/agents/tools/agentCall.ts +4 -2
- package/src/agents/tools/fileSearch.ts +5 -1
- package/src/agents/tools/list.ts +41 -37
- package/src/agents/tools/startAgentTask.ts +131 -22
- package/src/chat/CliChatService.ts +57 -11
- package/src/chat/modules/AgentModule.ts +72 -12
- package/src/chat/modules/CustomCommandsModule.ts +79 -0
- package/src/chat/modules/InternalChatModule.ts +11 -1
- package/src/chat/modules/ShellCommandModule.ts +96 -0
- package/src/chat/modules/index.ts +1 -0
- package/src/chat/types.ts +14 -2
- package/src/chat.ts +16 -13
- package/src/cli.ts +16 -6
- package/src/clients/anthropic.ts +88 -91
- package/src/clients/gemini.ts +495 -94
- package/src/clients/index.ts +125 -0
- package/src/clients/knowhow.ts +81 -0
- package/src/clients/openai.ts +256 -145
- package/src/clients/pricing/anthropic.ts +90 -0
- package/src/clients/pricing/google.ts +65 -0
- package/src/clients/pricing/index.ts +4 -0
- package/src/clients/pricing/openai.ts +134 -0
- package/src/clients/pricing/xai.ts +62 -0
- package/src/clients/types.ts +170 -1
- package/src/clients/xai.ts +275 -46
- package/src/config.ts +61 -15
- package/src/embeddings.ts +9 -1
- package/src/microphone.ts +15 -16
- package/src/migrations.ts +151 -0
- package/src/plugins/AgentsMdPlugin.ts +118 -0
- package/src/plugins/PluginBase.ts +8 -0
- package/src/plugins/downloader/downloader.ts +5 -6
- package/src/plugins/embedding.ts +10 -8
- package/src/plugins/exec.ts +70 -0
- package/src/plugins/github.ts +120 -74
- package/src/plugins/language.ts +11 -13
- package/src/plugins/plugins.ts +25 -4
- package/src/plugins/tmux.ts +132 -0
- package/src/plugins/types.ts +1 -0
- package/src/plugins/vim.ts +14 -1
- package/src/server/index.ts +2 -0
- package/src/services/AgentSyncFs.ts +417 -0
- package/src/services/{AgentSynchronization.ts → AgentSyncKnowhowWeb.ts} +2 -2
- package/src/services/EventService.ts +0 -1
- package/src/services/KnowhowClient.ts +106 -0
- package/src/services/index.ts +4 -2
- package/src/types.ts +57 -4
- package/src/worker.ts +25 -2
- package/tests/manual/modalities/README.md +157 -0
- package/tests/manual/modalities/google.modalities.test.ts +335 -0
- package/tests/manual/modalities/openai.modalities.test.ts +329 -0
- package/tests/manual/modalities/streaming.test.ts +260 -0
- package/tests/manual/modalities/xai.modalities.test.ts +307 -0
- package/tests/plugins/language/languagePlugin-content-triggers.test.ts +5 -5
- package/tests/plugins/language/languagePlugin-integration.test.ts +1 -1
- package/tests/plugins/language/languagePlugin.test.ts +17 -8
- package/ts_build/package.json +2 -2
- package/ts_build/src/agents/base/base.js +1 -1
- package/ts_build/src/agents/base/base.js.map +1 -1
- package/ts_build/src/agents/developer/developer.js +21 -15
- package/ts_build/src/agents/developer/developer.js.map +1 -1
- package/ts_build/src/agents/tools/agentCall.js +4 -2
- package/ts_build/src/agents/tools/agentCall.js.map +1 -1
- package/ts_build/src/agents/tools/executeScript/index.d.ts +1 -1
- package/ts_build/src/agents/tools/fileSearch.js +2 -1
- package/ts_build/src/agents/tools/fileSearch.js.map +1 -1
- package/ts_build/src/agents/tools/github/index.d.ts +1 -1
- package/ts_build/src/agents/tools/list.js +41 -37
- package/ts_build/src/agents/tools/list.js.map +1 -1
- package/ts_build/src/agents/tools/startAgentTask.d.ts +2 -1
- package/ts_build/src/agents/tools/startAgentTask.js +118 -17
- package/ts_build/src/agents/tools/startAgentTask.js.map +1 -1
- package/ts_build/src/chat/CliChatService.d.ts +4 -0
- package/ts_build/src/chat/CliChatService.js +39 -5
- package/ts_build/src/chat/CliChatService.js.map +1 -1
- package/ts_build/src/chat/modules/AgentModule.d.ts +4 -1
- package/ts_build/src/chat/modules/AgentModule.js +49 -11
- package/ts_build/src/chat/modules/AgentModule.js.map +1 -1
- package/ts_build/src/chat/modules/CustomCommandsModule.d.ts +9 -0
- package/ts_build/src/chat/modules/CustomCommandsModule.js +58 -0
- package/ts_build/src/chat/modules/CustomCommandsModule.js.map +1 -0
- package/ts_build/src/chat/modules/InternalChatModule.d.ts +2 -0
- package/ts_build/src/chat/modules/InternalChatModule.js +10 -0
- package/ts_build/src/chat/modules/InternalChatModule.js.map +1 -1
- package/ts_build/src/chat/modules/ShellCommandModule.d.ts +8 -0
- package/ts_build/src/chat/modules/ShellCommandModule.js +83 -0
- package/ts_build/src/chat/modules/ShellCommandModule.js.map +1 -0
- package/ts_build/src/chat/modules/index.d.ts +1 -0
- package/ts_build/src/chat/modules/index.js +3 -1
- package/ts_build/src/chat/modules/index.js.map +1 -1
- package/ts_build/src/chat/types.d.ts +11 -1
- package/ts_build/src/chat.js +16 -13
- package/ts_build/src/chat.js.map +1 -1
- package/ts_build/src/cli.js +10 -3
- package/ts_build/src/cli.js.map +1 -1
- package/ts_build/src/clients/anthropic.d.ts +6 -1
- package/ts_build/src/clients/anthropic.js +47 -92
- package/ts_build/src/clients/anthropic.js.map +1 -1
- package/ts_build/src/clients/gemini.d.ts +81 -2
- package/ts_build/src/clients/gemini.js +362 -79
- package/ts_build/src/clients/gemini.js.map +1 -1
- package/ts_build/src/clients/index.d.ts +9 -1
- package/ts_build/src/clients/index.js +65 -0
- package/ts_build/src/clients/index.js.map +1 -1
- package/ts_build/src/clients/knowhow.d.ts +9 -1
- package/ts_build/src/clients/knowhow.js +43 -0
- package/ts_build/src/clients/knowhow.js.map +1 -1
- package/ts_build/src/clients/openai.d.ts +9 -1
- package/ts_build/src/clients/openai.js +201 -133
- package/ts_build/src/clients/openai.js.map +1 -1
- package/ts_build/src/clients/pricing/anthropic.d.ts +17 -0
- package/ts_build/src/clients/pricing/anthropic.js +93 -0
- package/ts_build/src/clients/pricing/anthropic.js.map +1 -0
- package/ts_build/src/clients/pricing/google.d.ts +73 -0
- package/ts_build/src/clients/pricing/google.js +68 -0
- package/ts_build/src/clients/pricing/google.js.map +1 -0
- package/ts_build/src/clients/pricing/index.d.ts +4 -0
- package/ts_build/src/clients/pricing/index.js +14 -0
- package/ts_build/src/clients/pricing/index.js.map +1 -0
- package/ts_build/src/clients/pricing/openai.d.ts +7 -0
- package/ts_build/src/clients/pricing/openai.js +137 -0
- package/ts_build/src/clients/pricing/openai.js.map +1 -0
- package/ts_build/src/clients/pricing/xai.d.ts +26 -0
- package/ts_build/src/clients/pricing/xai.js +59 -0
- package/ts_build/src/clients/pricing/xai.js.map +1 -0
- package/ts_build/src/clients/types.d.ts +135 -0
- package/ts_build/src/clients/xai.d.ts +9 -1
- package/ts_build/src/clients/xai.js +178 -46
- package/ts_build/src/clients/xai.js.map +1 -1
- package/ts_build/src/config.d.ts +1 -0
- package/ts_build/src/config.js +45 -16
- package/ts_build/src/config.js.map +1 -1
- package/ts_build/src/embeddings.js +8 -1
- package/ts_build/src/embeddings.js.map +1 -1
- package/ts_build/src/microphone.js +7 -9
- package/ts_build/src/microphone.js.map +1 -1
- package/ts_build/src/migrations.d.ts +17 -0
- package/ts_build/src/migrations.js +86 -0
- package/ts_build/src/migrations.js.map +1 -0
- package/ts_build/src/plugins/AgentsMdPlugin.d.ts +13 -0
- package/ts_build/src/plugins/AgentsMdPlugin.js +118 -0
- package/ts_build/src/plugins/AgentsMdPlugin.js.map +1 -0
- package/ts_build/src/plugins/PluginBase.d.ts +1 -0
- package/ts_build/src/plugins/PluginBase.js +3 -0
- package/ts_build/src/plugins/PluginBase.js.map +1 -1
- package/ts_build/src/plugins/downloader/downloader.js +5 -5
- package/ts_build/src/plugins/downloader/downloader.js.map +1 -1
- package/ts_build/src/plugins/embedding.js +9 -8
- package/ts_build/src/plugins/embedding.js.map +1 -1
- package/ts_build/src/plugins/exec.d.ts +10 -0
- package/ts_build/src/plugins/exec.js +56 -0
- package/ts_build/src/plugins/exec.js.map +1 -0
- package/ts_build/src/plugins/github.js +93 -51
- package/ts_build/src/plugins/github.js.map +1 -1
- package/ts_build/src/plugins/language.js +14 -11
- package/ts_build/src/plugins/language.js.map +1 -1
- package/ts_build/src/plugins/plugins.d.ts +1 -0
- package/ts_build/src/plugins/plugins.js +19 -1
- package/ts_build/src/plugins/plugins.js.map +1 -1
- package/ts_build/src/plugins/tmux.d.ts +14 -0
- package/ts_build/src/plugins/tmux.js +108 -0
- package/ts_build/src/plugins/tmux.js.map +1 -0
- package/ts_build/src/plugins/types.d.ts +1 -0
- package/ts_build/src/plugins/vim.js +11 -1
- package/ts_build/src/plugins/vim.js.map +1 -1
- package/ts_build/src/server/index.js.map +1 -1
- package/ts_build/src/services/AgentSyncFs.d.ts +34 -0
- package/ts_build/src/services/AgentSyncFs.js +325 -0
- package/ts_build/src/services/AgentSyncFs.js.map +1 -0
- package/ts_build/src/services/AgentSyncKnowhowWeb.d.ts +29 -0
- package/ts_build/src/services/AgentSyncKnowhowWeb.js +178 -0
- package/ts_build/src/services/AgentSyncKnowhowWeb.js.map +1 -0
- package/ts_build/src/services/AgentSynchronization.d.ts +1 -1
- package/ts_build/src/services/AgentSynchronization.js +3 -3
- package/ts_build/src/services/AgentSynchronization.js.map +1 -1
- package/ts_build/src/services/EventService.js.map +1 -1
- package/ts_build/src/services/KnowhowClient.d.ts +9 -1
- package/ts_build/src/services/KnowhowClient.js +58 -0
- package/ts_build/src/services/KnowhowClient.js.map +1 -1
- package/ts_build/src/services/index.d.ts +2 -1
- package/ts_build/src/services/index.js +2 -1
- package/ts_build/src/services/index.js.map +1 -1
- package/ts_build/src/types.d.ts +26 -1
- package/ts_build/src/types.js +45 -4
- package/ts_build/src/types.js.map +1 -1
- package/ts_build/src/utils/PersistentInputManager.d.ts +28 -0
- package/ts_build/src/utils/PersistentInputManager.js +293 -0
- package/ts_build/src/utils/PersistentInputManager.js.map +1 -0
- package/ts_build/src/worker.js +11 -2
- package/ts_build/src/worker.js.map +1 -1
- package/ts_build/tests/manual/modalities/google.modalities.test.d.ts +1 -0
- package/ts_build/tests/manual/modalities/google.modalities.test.js +252 -0
- package/ts_build/tests/manual/modalities/google.modalities.test.js.map +1 -0
- package/ts_build/tests/manual/modalities/openai.modalities.test.d.ts +1 -0
- package/ts_build/tests/manual/modalities/openai.modalities.test.js +252 -0
- package/ts_build/tests/manual/modalities/openai.modalities.test.js.map +1 -0
- package/ts_build/tests/manual/modalities/streaming.test.d.ts +1 -0
- package/ts_build/tests/manual/modalities/streaming.test.js +206 -0
- package/ts_build/tests/manual/modalities/streaming.test.js.map +1 -0
- package/ts_build/tests/manual/modalities/xai.modalities.test.d.ts +1 -0
- package/ts_build/tests/manual/modalities/xai.modalities.test.js +226 -0
- package/ts_build/tests/manual/modalities/xai.modalities.test.js.map +1 -0
- package/ts_build/tests/manual/persistent-input-test.d.ts +1 -0
- package/ts_build/tests/manual/persistent-input-test.js +35 -0
- package/ts_build/tests/manual/persistent-input-test.js.map +1 -0
- package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js +5 -5
- package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js.map +1 -1
- package/ts_build/tests/plugins/language/languagePlugin-integration.test.js +1 -1
- package/ts_build/tests/plugins/language/languagePlugin-integration.test.js.map +1 -1
- package/ts_build/tests/plugins/language/languagePlugin.test.js +17 -7
- package/ts_build/tests/plugins/language/languagePlugin.test.js.map +1 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Models } from "../../types";
|
|
2
|
+
|
|
3
|
+
export const AnthropicTextPricing = {
|
|
4
|
+
[Models.anthropic.Opus4_6]: {
|
|
5
|
+
input: 5.0,
|
|
6
|
+
input_gt_200k: 10.0,
|
|
7
|
+
cache_write: 6.25,
|
|
8
|
+
cache_hit: 0.5,
|
|
9
|
+
output: 25.0,
|
|
10
|
+
output_gt_200k: 37.5,
|
|
11
|
+
},
|
|
12
|
+
[Models.anthropic.Sonnet4_6]: {
|
|
13
|
+
input: 3.0,
|
|
14
|
+
input_gt_200k: 6.0,
|
|
15
|
+
cache_write: 3.75,
|
|
16
|
+
cache_hit: 0.3,
|
|
17
|
+
output: 15.0,
|
|
18
|
+
output_gt_200k: 22.5,
|
|
19
|
+
},
|
|
20
|
+
[Models.anthropic.Opus4_5]: {
|
|
21
|
+
input: 5.0,
|
|
22
|
+
cache_write: 6.25,
|
|
23
|
+
cache_hit: 0.5,
|
|
24
|
+
output: 25.0,
|
|
25
|
+
},
|
|
26
|
+
[Models.anthropic.Opus4_1]: {
|
|
27
|
+
input: 15.0,
|
|
28
|
+
cache_write: 18.75,
|
|
29
|
+
cache_hit: 1.5,
|
|
30
|
+
output: 75.0,
|
|
31
|
+
},
|
|
32
|
+
[Models.anthropic.Opus4]: {
|
|
33
|
+
input: 15.0,
|
|
34
|
+
cache_write: 18.75,
|
|
35
|
+
cache_hit: 1.5,
|
|
36
|
+
output: 75.0,
|
|
37
|
+
},
|
|
38
|
+
[Models.anthropic.Sonnet4]: {
|
|
39
|
+
input: 3.0,
|
|
40
|
+
input_gt_200k: 6.0,
|
|
41
|
+
cache_write: 3.75,
|
|
42
|
+
cache_hit: 0.3,
|
|
43
|
+
output: 15.0,
|
|
44
|
+
output_gt_200k: 22.5,
|
|
45
|
+
},
|
|
46
|
+
[Models.anthropic.Sonnet4_5]: {
|
|
47
|
+
input: 3.0,
|
|
48
|
+
input_gt_200k: 6.0,
|
|
49
|
+
cache_write: 3.75,
|
|
50
|
+
cache_hit: 0.3,
|
|
51
|
+
output: 15.0,
|
|
52
|
+
output_gt_200k: 22.5,
|
|
53
|
+
},
|
|
54
|
+
[Models.anthropic.Haiku4_5]: {
|
|
55
|
+
input: 1,
|
|
56
|
+
cache_write: 1.25,
|
|
57
|
+
cache_hit: 0.1,
|
|
58
|
+
output: 5,
|
|
59
|
+
},
|
|
60
|
+
[Models.anthropic.Sonnet3_7]: {
|
|
61
|
+
input: 3.0,
|
|
62
|
+
cache_write: 3.75,
|
|
63
|
+
cache_hit: 0.3,
|
|
64
|
+
output: 15.0,
|
|
65
|
+
},
|
|
66
|
+
[Models.anthropic.Sonnet3_5]: {
|
|
67
|
+
input: 3.0,
|
|
68
|
+
cache_write: 3.75,
|
|
69
|
+
cache_hit: 0.3,
|
|
70
|
+
output: 15.0,
|
|
71
|
+
},
|
|
72
|
+
[Models.anthropic.Haiku3_5]: {
|
|
73
|
+
input: 0.8,
|
|
74
|
+
cache_write: 1.0,
|
|
75
|
+
cache_hit: 0.08,
|
|
76
|
+
output: 4.0,
|
|
77
|
+
},
|
|
78
|
+
[Models.anthropic.Opus3]: {
|
|
79
|
+
input: 15.0,
|
|
80
|
+
cache_write: 18.75,
|
|
81
|
+
cache_hit: 1.5,
|
|
82
|
+
output: 75.0,
|
|
83
|
+
},
|
|
84
|
+
[Models.anthropic.Haiku3]: {
|
|
85
|
+
input: 0.25,
|
|
86
|
+
cache_write: 0.3125,
|
|
87
|
+
cache_hit: 0.025,
|
|
88
|
+
output: 1.25,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Models, EmbeddingModels } from "../../types";
|
|
2
|
+
|
|
3
|
+
export const GeminiTextPricing = {
|
|
4
|
+
[Models.google.Gemini_3_Preview]: {
|
|
5
|
+
input: 2,
|
|
6
|
+
input_gt_200k: 4,
|
|
7
|
+
output: 12,
|
|
8
|
+
output_gt_200k: 18,
|
|
9
|
+
context_caching: 0.2,
|
|
10
|
+
context_caching_gt_200k: 0.4,
|
|
11
|
+
},
|
|
12
|
+
[Models.google.Gemini_25_Flash_Preview]: {
|
|
13
|
+
input: 0.3,
|
|
14
|
+
output: 2.5,
|
|
15
|
+
thinking_output: 3.5,
|
|
16
|
+
context_caching: 0.0375,
|
|
17
|
+
},
|
|
18
|
+
[Models.google.Gemini_25_Pro_Preview]: {
|
|
19
|
+
input: 1.25,
|
|
20
|
+
input_gt_200k: 2.5,
|
|
21
|
+
output: 10.0,
|
|
22
|
+
output_gt_200k: 15.0,
|
|
23
|
+
context_caching: 0.125,
|
|
24
|
+
context_caching_gt_200k: 0.25,
|
|
25
|
+
},
|
|
26
|
+
[Models.google.Gemini_20_Flash]: {
|
|
27
|
+
input: 0.1,
|
|
28
|
+
output: 0.4,
|
|
29
|
+
context_caching: 0.025,
|
|
30
|
+
},
|
|
31
|
+
[Models.google.Gemini_20_Flash_Preview_Image_Generation]: {
|
|
32
|
+
input: 0.1,
|
|
33
|
+
output: 0.4,
|
|
34
|
+
image_generation: 0.039,
|
|
35
|
+
},
|
|
36
|
+
[Models.google.Gemini_20_Flash_Lite]: {
|
|
37
|
+
input: 0.075,
|
|
38
|
+
output: 0.3,
|
|
39
|
+
},
|
|
40
|
+
[Models.google.Gemini_15_Flash]: {
|
|
41
|
+
input: 0.075,
|
|
42
|
+
output: 0.3,
|
|
43
|
+
context_caching: 0.01875,
|
|
44
|
+
},
|
|
45
|
+
[Models.google.Gemini_15_Flash_8B]: {
|
|
46
|
+
input: 0.0375,
|
|
47
|
+
output: 0.15,
|
|
48
|
+
context_caching: 0.01,
|
|
49
|
+
},
|
|
50
|
+
[Models.google.Gemini_15_Pro]: {
|
|
51
|
+
input: 1.25,
|
|
52
|
+
output: 5.0,
|
|
53
|
+
context_caching: 0.3125,
|
|
54
|
+
},
|
|
55
|
+
[Models.google.Imagen_3]: {
|
|
56
|
+
image_generation: 0.03,
|
|
57
|
+
},
|
|
58
|
+
[Models.google.Veo_2]: {
|
|
59
|
+
video_generation: 0.35,
|
|
60
|
+
},
|
|
61
|
+
[EmbeddingModels.google.Gemini_Embedding]: {
|
|
62
|
+
input: 0, // Free of charge
|
|
63
|
+
output: 0, // Free of charge
|
|
64
|
+
},
|
|
65
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Models, EmbeddingModels } from "../../types";
|
|
2
|
+
|
|
3
|
+
export const OpenAiTextPricing = {
|
|
4
|
+
[Models.openai.GPT_4o]: {
|
|
5
|
+
input: 2.5,
|
|
6
|
+
cached_input: 1.25,
|
|
7
|
+
output: 10.0,
|
|
8
|
+
},
|
|
9
|
+
[Models.openai.GPT_4o_Mini]: {
|
|
10
|
+
input: 0.15,
|
|
11
|
+
cached_input: 0.075,
|
|
12
|
+
output: 0.6,
|
|
13
|
+
},
|
|
14
|
+
[Models.openai.o1]: {
|
|
15
|
+
input: 15.0,
|
|
16
|
+
cached_input: 7.5,
|
|
17
|
+
output: 60.0,
|
|
18
|
+
},
|
|
19
|
+
[Models.openai.o1_Mini]: {
|
|
20
|
+
input: 1.1,
|
|
21
|
+
cached_input: 0.55,
|
|
22
|
+
output: 4.4,
|
|
23
|
+
},
|
|
24
|
+
[Models.openai.o3_Mini]: {
|
|
25
|
+
input: 1.1,
|
|
26
|
+
cached_input: 0.55,
|
|
27
|
+
output: 4.4,
|
|
28
|
+
},
|
|
29
|
+
[Models.openai.GPT_41]: {
|
|
30
|
+
input: 2.0,
|
|
31
|
+
cached_input: 0.5,
|
|
32
|
+
output: 8.0,
|
|
33
|
+
},
|
|
34
|
+
[Models.openai.GPT_41_Mini]: {
|
|
35
|
+
input: 0.4,
|
|
36
|
+
cached_input: 0.1,
|
|
37
|
+
output: 1.6,
|
|
38
|
+
},
|
|
39
|
+
[Models.openai.GPT_41_Nano]: {
|
|
40
|
+
input: 0.1,
|
|
41
|
+
cached_input: 0.025,
|
|
42
|
+
output: 0.4,
|
|
43
|
+
},
|
|
44
|
+
[Models.openai.GPT_45]: {
|
|
45
|
+
input: 75.0,
|
|
46
|
+
cached_input: 37.5,
|
|
47
|
+
output: 150.0,
|
|
48
|
+
},
|
|
49
|
+
[Models.openai.GPT_4o_Audio]: {
|
|
50
|
+
input: 2.5,
|
|
51
|
+
cached_input: 0,
|
|
52
|
+
output: 10.0,
|
|
53
|
+
},
|
|
54
|
+
[Models.openai.GPT_4o_Realtime]: {
|
|
55
|
+
input: 5.0,
|
|
56
|
+
cached_input: 2.5,
|
|
57
|
+
output: 20.0,
|
|
58
|
+
},
|
|
59
|
+
[Models.openai.GPT_4o_Mini_Audio]: {
|
|
60
|
+
input: 0.15,
|
|
61
|
+
cached_input: 0,
|
|
62
|
+
output: 0.6,
|
|
63
|
+
},
|
|
64
|
+
[Models.openai.GPT_4o_Mini_Realtime]: {
|
|
65
|
+
input: 0.6,
|
|
66
|
+
cached_input: 0.3,
|
|
67
|
+
output: 2.4,
|
|
68
|
+
},
|
|
69
|
+
[Models.openai.o1_Pro]: {
|
|
70
|
+
input: 150.0,
|
|
71
|
+
cached_input: 0,
|
|
72
|
+
output: 600.0,
|
|
73
|
+
},
|
|
74
|
+
[Models.openai.o3]: {
|
|
75
|
+
input: 2.0,
|
|
76
|
+
cached_input: 0.5,
|
|
77
|
+
output: 8.0,
|
|
78
|
+
},
|
|
79
|
+
[Models.openai.o4_Mini]: {
|
|
80
|
+
input: 1.1,
|
|
81
|
+
cached_input: 0.275,
|
|
82
|
+
output: 4.4,
|
|
83
|
+
},
|
|
84
|
+
[Models.openai.GPT_4o_Mini_Search]: {
|
|
85
|
+
input: 0.15,
|
|
86
|
+
cached_input: 0,
|
|
87
|
+
output: 0.6,
|
|
88
|
+
},
|
|
89
|
+
[Models.openai.GPT_4o_Search]: {
|
|
90
|
+
input: 2.5,
|
|
91
|
+
cached_input: 0,
|
|
92
|
+
output: 10.0,
|
|
93
|
+
},
|
|
94
|
+
[Models.openai.GPT_5_2]: {
|
|
95
|
+
input: 1.75,
|
|
96
|
+
cached_input: 0.175,
|
|
97
|
+
output: 14,
|
|
98
|
+
},
|
|
99
|
+
[Models.openai.GPT_5_1]: {
|
|
100
|
+
input: 1.25,
|
|
101
|
+
cached_input: 0.125,
|
|
102
|
+
output: 10,
|
|
103
|
+
},
|
|
104
|
+
[Models.openai.GPT_5]: {
|
|
105
|
+
input: 1.25,
|
|
106
|
+
cached_input: 0.125,
|
|
107
|
+
output: 10,
|
|
108
|
+
},
|
|
109
|
+
[Models.openai.GPT_5_Mini]: {
|
|
110
|
+
input: 0.25,
|
|
111
|
+
cached_input: 0.025,
|
|
112
|
+
output: 2,
|
|
113
|
+
},
|
|
114
|
+
[Models.openai.GPT_5_Nano]: {
|
|
115
|
+
input: 0.05,
|
|
116
|
+
cached_input: 0.005,
|
|
117
|
+
output: 0.4,
|
|
118
|
+
},
|
|
119
|
+
[EmbeddingModels.openai.EmbeddingAda2]: {
|
|
120
|
+
input: 0.1,
|
|
121
|
+
cached_input: 0,
|
|
122
|
+
output: 0,
|
|
123
|
+
},
|
|
124
|
+
[EmbeddingModels.openai.EmbeddingLarge3]: {
|
|
125
|
+
input: 0.13,
|
|
126
|
+
cached_input: 0,
|
|
127
|
+
output: 0,
|
|
128
|
+
},
|
|
129
|
+
[EmbeddingModels.openai.EmbeddingSmall3]: {
|
|
130
|
+
input: 0.02,
|
|
131
|
+
cached_input: 0,
|
|
132
|
+
output: 0,
|
|
133
|
+
},
|
|
134
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Models } from "../../types";
|
|
2
|
+
|
|
3
|
+
export const XaiTextPricing = {
|
|
4
|
+
[Models.xai.Grok4_1_Fast_NonReasoning]: {
|
|
5
|
+
input: 0.2,
|
|
6
|
+
cache_hit: 0.05,
|
|
7
|
+
output: 0.5,
|
|
8
|
+
},
|
|
9
|
+
[Models.xai.Grok4_1_Fast_Reasoning]: {
|
|
10
|
+
input: 0.2,
|
|
11
|
+
cache_hit: 0.05,
|
|
12
|
+
output: 0.5,
|
|
13
|
+
},
|
|
14
|
+
[Models.xai.GrokCodeFast]: {
|
|
15
|
+
input: 0.2,
|
|
16
|
+
cache_hit: 0.02,
|
|
17
|
+
output: 1.5,
|
|
18
|
+
},
|
|
19
|
+
[Models.xai.Grok4]: {
|
|
20
|
+
input: 3.0,
|
|
21
|
+
output: 15.0,
|
|
22
|
+
},
|
|
23
|
+
[Models.xai.Grok3Beta]: {
|
|
24
|
+
input: 3.0,
|
|
25
|
+
output: 15.0,
|
|
26
|
+
},
|
|
27
|
+
[Models.xai.Grok3MiniBeta]: {
|
|
28
|
+
input: 0.3,
|
|
29
|
+
output: 0.5,
|
|
30
|
+
},
|
|
31
|
+
[Models.xai.Grok3FastBeta]: {
|
|
32
|
+
input: 5.0,
|
|
33
|
+
output: 25.0,
|
|
34
|
+
},
|
|
35
|
+
[Models.xai.Grok3MiniFastBeta]: {
|
|
36
|
+
input: 0.6,
|
|
37
|
+
output: 4.0,
|
|
38
|
+
},
|
|
39
|
+
[Models.xai.Grok21212]: {
|
|
40
|
+
input: 2.0,
|
|
41
|
+
output: 10.0,
|
|
42
|
+
},
|
|
43
|
+
[Models.xai.Grok2Vision1212]: {
|
|
44
|
+
input: 2.0,
|
|
45
|
+
output: 10.0,
|
|
46
|
+
image_input: 2.0,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Image generation pricing: per image
|
|
51
|
+
// Based on https://docs.x.ai/developers/models
|
|
52
|
+
export const XaiImagePricing = {
|
|
53
|
+
"grok-imagine-image-pro": 0.07,
|
|
54
|
+
"grok-imagine-image": 0.02,
|
|
55
|
+
"grok-2-image-1212": 0.07,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Video generation pricing: $0.05 per second
|
|
59
|
+
// Based on https://docs.x.ai/developers/models
|
|
60
|
+
export const XaiVideoPricing = {
|
|
61
|
+
"grok-imagine-video": 0.05, // per second
|
|
62
|
+
};
|
package/src/clients/types.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type MessageContent =
|
|
2
2
|
| { type: "text"; text: string }
|
|
3
|
-
| { type: "image_url"; image_url: { url: string } }
|
|
3
|
+
| { type: "image_url"; image_url: { url: string } }
|
|
4
|
+
| { type: "audio_url"; audio_url: { url: string } }
|
|
5
|
+
| { type: "video_url"; video_url: { url: string } };
|
|
4
6
|
|
|
5
7
|
export interface Message {
|
|
6
8
|
role: "system" | "user" | "assistant" | "tool";
|
|
@@ -84,9 +86,176 @@ export interface EmbeddingResponse {
|
|
|
84
86
|
usd_cost?: number;
|
|
85
87
|
}
|
|
86
88
|
|
|
89
|
+
export interface AudioTranscriptionOptions {
|
|
90
|
+
file: Blob | File | any; // Support for Node.js ReadStream or web File/Blob
|
|
91
|
+
model?: string;
|
|
92
|
+
language?: string;
|
|
93
|
+
prompt?: string;
|
|
94
|
+
response_format?: "json" | "text" | "srt" | "verbose_json" | "vtt";
|
|
95
|
+
temperature?: number;
|
|
96
|
+
/** Optional file name hint used when constructing multipart form data */
|
|
97
|
+
fileName?: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface AudioTranscriptionResponse {
|
|
101
|
+
text: string;
|
|
102
|
+
language?: string;
|
|
103
|
+
duration?: number;
|
|
104
|
+
segments?: Array<{
|
|
105
|
+
id: number;
|
|
106
|
+
seek: number;
|
|
107
|
+
start: number;
|
|
108
|
+
end: number;
|
|
109
|
+
text: string;
|
|
110
|
+
tokens: number[];
|
|
111
|
+
temperature: number;
|
|
112
|
+
avg_logprob: number;
|
|
113
|
+
compression_ratio: number;
|
|
114
|
+
no_speech_prob: number;
|
|
115
|
+
}>;
|
|
116
|
+
usd_cost?: number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface AudioGenerationOptions {
|
|
120
|
+
model: string;
|
|
121
|
+
input: string;
|
|
122
|
+
voice: string; // e.g. "alloy", "echo", "fable", "onyx", "nova", "shimmer" for OpenAI; "Kore", "Puck" etc. for Gemini
|
|
123
|
+
response_format?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm";
|
|
124
|
+
speed?: number;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface AudioGenerationResponse {
|
|
128
|
+
audio: Buffer;
|
|
129
|
+
format: string;
|
|
130
|
+
usd_cost?: number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface ImageGenerationOptions {
|
|
134
|
+
model: string;
|
|
135
|
+
prompt: string;
|
|
136
|
+
n?: number;
|
|
137
|
+
size?: "256x256" | "512x512" | "1024x1024" | "1792x1024" | "1024x1792";
|
|
138
|
+
quality?: "standard" | "hd";
|
|
139
|
+
style?: "vivid" | "natural";
|
|
140
|
+
response_format?: "url" | "b64_json";
|
|
141
|
+
user?: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface ImageGenerationResponse {
|
|
145
|
+
created: number;
|
|
146
|
+
data: Array<{
|
|
147
|
+
url?: string;
|
|
148
|
+
b64_json?: string;
|
|
149
|
+
revised_prompt?: string;
|
|
150
|
+
}>;
|
|
151
|
+
usd_cost?: number;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface VideoGenerationOptions {
|
|
155
|
+
model: string;
|
|
156
|
+
prompt: string;
|
|
157
|
+
duration?: number; // seconds
|
|
158
|
+
resolution?: string; // e.g. "1080p", "720p"
|
|
159
|
+
aspect_ratio?: string; // e.g. "16:9", "9:16", "1:1"
|
|
160
|
+
n?: number; // number of videos to generate
|
|
161
|
+
image_url?: string; // for image-to-video (XAI)
|
|
162
|
+
video_url?: string; // for video editing (XAI)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface VideoGenerationResponse {
|
|
166
|
+
created: number;
|
|
167
|
+
data: Array<{
|
|
168
|
+
url?: string;
|
|
169
|
+
b64_json?: string;
|
|
170
|
+
video?: Buffer;
|
|
171
|
+
}>;
|
|
172
|
+
/** Opaque provider-specific job/operation ID used for status polling */
|
|
173
|
+
jobId?: string;
|
|
174
|
+
usd_cost?: number;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface VideoStatusOptions {
|
|
178
|
+
/** The job/operation ID returned from createVideoGeneration */
|
|
179
|
+
jobId: string;
|
|
180
|
+
model?: string;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface VideoStatusResponse {
|
|
184
|
+
jobId: string;
|
|
185
|
+
/** "queued" | "in_progress" | "completed" | "failed" | "expired" */
|
|
186
|
+
status: "queued" | "in_progress" | "completed" | "failed" | "expired";
|
|
187
|
+
/** Available when status === "completed" */
|
|
188
|
+
data?: Array<{
|
|
189
|
+
url?: string;
|
|
190
|
+
b64_json?: string;
|
|
191
|
+
/** File resource name (Google) or asset identifier (other providers) */
|
|
192
|
+
fileUri?: string;
|
|
193
|
+
}>;
|
|
194
|
+
error?: string;
|
|
195
|
+
progress?: number;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ─── File API ────────────────────────────────────────────────────────────────
|
|
199
|
+
|
|
200
|
+
export interface FileUploadOptions {
|
|
201
|
+
/** Raw bytes to upload */
|
|
202
|
+
data: Buffer;
|
|
203
|
+
/** MIME type of the file, e.g. "video/mp4", "image/png" */
|
|
204
|
+
mimeType: string;
|
|
205
|
+
/** Optional display name */
|
|
206
|
+
displayName?: string;
|
|
207
|
+
/** Optional file name hint (used as key / object key on some providers) */
|
|
208
|
+
fileName?: string;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface FileUploadResponse {
|
|
212
|
+
/** Opaque file identifier that can be passed to downloadFile */
|
|
213
|
+
fileId: string;
|
|
214
|
+
/** Public or signed URL (if available) */
|
|
215
|
+
url?: string;
|
|
216
|
+
/** The file's URI on the provider's storage (Google files API uri) */
|
|
217
|
+
uri?: string;
|
|
218
|
+
mimeType?: string;
|
|
219
|
+
sizeBytes?: number;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface FileDownloadOptions {
|
|
223
|
+
/** Opaque file identifier returned by uploadFile / VideoStatusResponse */
|
|
224
|
+
fileId: string;
|
|
225
|
+
/** Optional: full URI / URL if you already have it */
|
|
226
|
+
uri?: string;
|
|
227
|
+
/** Optional: local file path to save the downloaded file to directly */
|
|
228
|
+
filePath?: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface FileDownloadResponse {
|
|
232
|
+
data: Buffer;
|
|
233
|
+
mimeType?: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
87
236
|
export interface GenericClient {
|
|
88
237
|
setKey(key: string): void;
|
|
89
238
|
createChatCompletion(options: CompletionOptions): Promise<CompletionResponse>;
|
|
90
239
|
createEmbedding(options: EmbeddingOptions): Promise<EmbeddingResponse>;
|
|
240
|
+
createAudioTranscription?(
|
|
241
|
+
options: AudioTranscriptionOptions
|
|
242
|
+
): Promise<AudioTranscriptionResponse>;
|
|
243
|
+
createAudioGeneration?(
|
|
244
|
+
options: AudioGenerationOptions
|
|
245
|
+
): Promise<AudioGenerationResponse>;
|
|
246
|
+
createImageGeneration?(
|
|
247
|
+
options: ImageGenerationOptions
|
|
248
|
+
): Promise<ImageGenerationResponse>;
|
|
249
|
+
createVideoGeneration?(
|
|
250
|
+
options: VideoGenerationOptions
|
|
251
|
+
): Promise<VideoGenerationResponse>;
|
|
252
|
+
/** Poll or fetch the current status of a video generation job */
|
|
253
|
+
getVideoStatus?(options: VideoStatusOptions): Promise<VideoStatusResponse>;
|
|
254
|
+
/** Download the generated video as a Buffer */
|
|
255
|
+
downloadVideo?(options: FileDownloadOptions): Promise<FileDownloadResponse>;
|
|
256
|
+
/** Upload a file to the provider's file storage */
|
|
257
|
+
uploadFile?(options: FileUploadOptions): Promise<FileUploadResponse>;
|
|
258
|
+
/** Download a file from the provider's file storage */
|
|
259
|
+
downloadFile?(options: FileDownloadOptions): Promise<FileDownloadResponse>;
|
|
91
260
|
getModels(): Promise<{ id: string }[]>;
|
|
92
261
|
}
|