agentic-api 2.0.491 → 2.0.585

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.
Files changed (50) hide show
  1. package/README.md +37 -34
  2. package/dist/src/agents/reducer.core.js +2 -2
  3. package/dist/src/agents/simulator.d.ts +26 -1
  4. package/dist/src/agents/simulator.dashboard.d.ts +140 -0
  5. package/dist/src/agents/simulator.dashboard.js +344 -0
  6. package/dist/src/agents/simulator.js +56 -0
  7. package/dist/src/agents/simulator.types.d.ts +38 -6
  8. package/dist/src/agents/simulator.utils.d.ts +22 -1
  9. package/dist/src/agents/simulator.utils.js +27 -0
  10. package/dist/src/execute/helpers.js +2 -2
  11. package/dist/src/execute/modelconfig.d.ts +21 -11
  12. package/dist/src/execute/modelconfig.js +29 -13
  13. package/dist/src/execute/responses.js +8 -7
  14. package/dist/src/index.d.ts +5 -1
  15. package/dist/src/index.js +20 -1
  16. package/dist/src/llm/config.d.ts +25 -0
  17. package/dist/src/llm/config.js +38 -0
  18. package/dist/src/llm/index.d.ts +48 -0
  19. package/dist/src/llm/index.js +115 -0
  20. package/dist/src/llm/openai.d.ts +6 -0
  21. package/dist/src/llm/openai.js +154 -0
  22. package/dist/src/llm/pricing.d.ts +26 -0
  23. package/dist/src/llm/pricing.js +129 -0
  24. package/dist/src/llm/xai.d.ts +17 -0
  25. package/dist/src/llm/xai.js +90 -0
  26. package/dist/src/pricing.llm.d.ts +3 -15
  27. package/dist/src/pricing.llm.js +10 -251
  28. package/dist/src/prompts.d.ts +0 -1
  29. package/dist/src/prompts.js +51 -118
  30. package/dist/src/rag/embeddings.d.ts +5 -1
  31. package/dist/src/rag/embeddings.js +15 -5
  32. package/dist/src/rag/parser.js +1 -1
  33. package/dist/src/rag/rag.manager.d.ts +33 -2
  34. package/dist/src/rag/rag.manager.js +132 -46
  35. package/dist/src/rag/types.d.ts +2 -0
  36. package/dist/src/rag/usecase.js +8 -11
  37. package/dist/src/rules/git/git.health.js +59 -4
  38. package/dist/src/rules/git/repo.d.ts +11 -4
  39. package/dist/src/rules/git/repo.js +64 -18
  40. package/dist/src/rules/git/repo.pr.d.ts +8 -0
  41. package/dist/src/rules/git/repo.pr.js +45 -1
  42. package/dist/src/rules/git/repo.tools.d.ts +5 -1
  43. package/dist/src/rules/git/repo.tools.js +54 -7
  44. package/dist/src/rules/types.d.ts +14 -0
  45. package/dist/src/rules/utils.matter.d.ts +0 -20
  46. package/dist/src/rules/utils.matter.js +42 -74
  47. package/dist/src/scrapper.js +2 -2
  48. package/dist/src/utils.d.ts +0 -8
  49. package/dist/src/utils.js +1 -28
  50. package/package.json +1 -1
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ /**
3
+ * LLM Provider Instances
4
+ *
5
+ * Fournit une instance OpenAI configurable par provider:
6
+ * - llmInstance(): utilise LLM_PROVIDER depuis .env
7
+ * - llmInstance({provider: 'openai'}): force OpenAI
8
+ * - llmInstance({provider: 'xai'}): force xAI
9
+ *
10
+ * Configuration via .env:
11
+ * - LLM_PROVIDER: openai | xai (défaut: openai)
12
+ * - OPENAI_API_KEY: clé API OpenAI
13
+ * - XAI_API_KEY: clé API xAI
14
+ * - LLM_API_KEY: fallback pour les deux providers
15
+ */
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.getDefaultProvider = exports.detectProvider = exports.PROVIDER_MAP = void 0;
21
+ exports.llmInstance = llmInstance;
22
+ exports.openaiInstance = openaiInstance;
23
+ exports.resetInstances = resetInstances;
24
+ const openai_1 = __importDefault(require("openai"));
25
+ const config_1 = require("./config");
26
+ function getInstancesMap() {
27
+ if (!globalThis._llmInstances_) {
28
+ globalThis._llmInstances_ = new Map();
29
+ }
30
+ return globalThis._llmInstances_;
31
+ }
32
+ /**
33
+ * Instance LLM configurable par provider
34
+ *
35
+ * @param config - Configuration optionnelle
36
+ * @param config.provider - Provider à utiliser ('openai' | 'xai')
37
+ * @param config.key - Clé API (optionnel, utilise env par défaut)
38
+ * @param config.baseUrl - Base URL (optionnel, utilise config provider par défaut)
39
+ *
40
+ * @example
41
+ * // Utilise le provider par défaut (.env LLM_PROVIDER)
42
+ * const openai = llmInstance();
43
+ *
44
+ * // Force OpenAI (pour embeddings, whisper)
45
+ * const openai = llmInstance({provider: 'openai'});
46
+ *
47
+ * // Force xAI
48
+ * const openai = llmInstance({provider: 'xai'});
49
+ */
50
+ function llmInstance(config) {
51
+ const provider = config?.provider || (0, config_1.getDefaultProvider)();
52
+ const providerConfig = config_1.PROVIDER_MAP[provider];
53
+ if (!providerConfig) {
54
+ throw new Error(`Unknown provider: ${provider}. Valid providers: ${Object.keys(config_1.PROVIDER_MAP).join(', ')}`);
55
+ }
56
+ //
57
+ // Clé de cache: provider + éventuelles customisations
58
+ const cacheKey = config?.key || config?.baseUrl
59
+ ? `${provider}-${config?.key || ''}-${config?.baseUrl || ''}`
60
+ : provider;
61
+ const instances = getInstancesMap();
62
+ //
63
+ // Retourner l'instance existante si disponible (cache)
64
+ if (instances.has(cacheKey)) {
65
+ return instances.get(cacheKey);
66
+ }
67
+ //
68
+ // Résoudre la clé API: custom > provider env > fallback env
69
+ const apiKey = config?.key
70
+ || process.env[providerConfig.keyEnv]
71
+ || (providerConfig.fallbackKeyEnv ? process.env[providerConfig.fallbackKeyEnv] : undefined);
72
+ if (!apiKey) {
73
+ throw new Error(`API key missing for provider "${provider}". ` +
74
+ `Set ${providerConfig.keyEnv} or ${providerConfig.fallbackKeyEnv || 'LLM_API_KEY'} in your environment.`);
75
+ }
76
+ //
77
+ // Résoudre la base URL: custom > provider config
78
+ const baseURL = config?.baseUrl || providerConfig.baseURL;
79
+ const instance = new openai_1.default({
80
+ apiKey,
81
+ baseURL,
82
+ timeout: 60000 * 15,
83
+ });
84
+ instances.set(cacheKey, instance);
85
+ return instance;
86
+ }
87
+ /**
88
+ * @deprecated Utiliser llmInstance() à la place
89
+ * Alias pour rétrocompatibilité
90
+ */
91
+ function openaiInstance(envKey, baseUrl) {
92
+ //
93
+ // Si des paramètres legacy sont passés, les utiliser
94
+ if (envKey || baseUrl) {
95
+ const provider = baseUrl?.includes('x.ai') ? 'xai' : 'openai';
96
+ return llmInstance({
97
+ provider,
98
+ key: envKey ? (process.env[envKey] || envKey) : undefined,
99
+ baseUrl
100
+ });
101
+ }
102
+ return llmInstance();
103
+ }
104
+ /**
105
+ * Reset toutes les instances (utile pour les tests)
106
+ */
107
+ function resetInstances() {
108
+ globalThis._llmInstances_ = undefined;
109
+ }
110
+ //
111
+ // Re-export config
112
+ var config_2 = require("./config");
113
+ Object.defineProperty(exports, "PROVIDER_MAP", { enumerable: true, get: function () { return config_2.PROVIDER_MAP; } });
114
+ Object.defineProperty(exports, "detectProvider", { enumerable: true, get: function () { return config_2.detectProvider; } });
115
+ Object.defineProperty(exports, "getDefaultProvider", { enumerable: true, get: function () { return config_2.getDefaultProvider; } });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * OpenAI Model Mappings
3
+ *
4
+ * Configuration des modèles pour le provider OpenAI
5
+ */
6
+ export declare const LLMopenai: Record<string, any>;
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ /**
3
+ * OpenAI Model Mappings
4
+ *
5
+ * Configuration des modèles pour le provider OpenAI
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.LLMopenai = void 0;
9
+ exports.LLMopenai = {
10
+ // Vision capable models
11
+ "VISION": {
12
+ model: "gpt-5-mini",
13
+ temperature: 0.2,
14
+ stream: false
15
+ },
16
+ "VISION-fast": {
17
+ model: "gpt-5-mini",
18
+ temperature: 0.2,
19
+ stream: false
20
+ },
21
+ // Embedding models
22
+ // Note: memories-lite utilise ce modèle via agentic-server/src/config/memories.ts
23
+ // Usage: modelConfig('EMBEDDING-small', { provider: 'openai' }).model
24
+ "EMBEDDING-small": {
25
+ model: "text-embedding-3-small",
26
+ dimensions: 1536
27
+ },
28
+ "EMBEDDING-large": {
29
+ model: "text-embedding-3-large",
30
+ dimensions: 3072
31
+ },
32
+ // Audio models
33
+ "WHISPER": {
34
+ model: "whisper-1"
35
+ },
36
+ "TRANSCRIBE": {
37
+ model: "gpt-4o-mini-transcribe"
38
+ },
39
+ // Chat/Responses models
40
+ "LOW-fast": {
41
+ temperature: 1,
42
+ frequency_penalty: 0.0,
43
+ presence_penalty: 0.0,
44
+ model: "gpt-5-nano",
45
+ reasoning_effort: "minimal",
46
+ verbosity: "low",
47
+ stream: true
48
+ },
49
+ "LOW": {
50
+ temperature: 1,
51
+ frequency_penalty: 0.0,
52
+ presence_penalty: 0.0,
53
+ model: "gpt-5-nano",
54
+ reasoning_effort: "low",
55
+ verbosity: "low",
56
+ stream: true
57
+ },
58
+ "LOW-medium": {
59
+ temperature: 1,
60
+ frequency_penalty: 0.0,
61
+ presence_penalty: 0.0,
62
+ model: "gpt-5-nano",
63
+ reasoning_effort: "medium",
64
+ verbosity: "low",
65
+ stream: true
66
+ },
67
+ "LOW-4fast": {
68
+ temperature: .2,
69
+ frequency_penalty: 0.0,
70
+ presence_penalty: 0.0,
71
+ model: "gpt-4.1-nano",
72
+ stream: true
73
+ },
74
+ "MEDIUM-4.1-mini": {
75
+ temperature: .2,
76
+ frequency_penalty: 0.0,
77
+ presence_penalty: 0.0,
78
+ model: "gpt-4.1-mini",
79
+ stream: true
80
+ },
81
+ "MEDIUM-4.1": {
82
+ temperature: .2,
83
+ frequency_penalty: 0.0,
84
+ presence_penalty: 0.0,
85
+ model: "gpt-4.1",
86
+ stream: true
87
+ },
88
+ "MEDIUM-fast": {
89
+ temperature: 1,
90
+ frequency_penalty: 0.0,
91
+ presence_penalty: 0.0,
92
+ model: "gpt-5-mini",
93
+ reasoning_effort: "minimal",
94
+ verbosity: "low",
95
+ stream: true
96
+ },
97
+ "MEDIUM": {
98
+ temperature: 1,
99
+ frequency_penalty: 0.0,
100
+ presence_penalty: 0.0,
101
+ model: "gpt-5-mini",
102
+ reasoning_effort: "low",
103
+ verbosity: "low",
104
+ stream: true
105
+ },
106
+ "HIGH-fast": {
107
+ model: "gpt-5.2",
108
+ reasoning_effort: "none",
109
+ verbosity: "low",
110
+ temperature: 1,
111
+ stream: true
112
+ },
113
+ "HIGH": {
114
+ model: "gpt-5.2",
115
+ reasoning_effort: "low",
116
+ verbosity: "low",
117
+ stream: true
118
+ },
119
+ "HIGH-medium": {
120
+ model: "gpt-5.2",
121
+ reasoning_effort: "medium",
122
+ verbosity: "low",
123
+ stream: true
124
+ },
125
+ "SEARCH-fast": {
126
+ model: "gpt-5-nano",
127
+ tools: [
128
+ {
129
+ type: "web_search_preview",
130
+ user_location: {
131
+ type: "approximate",
132
+ country: "CH",
133
+ city: "Geneva",
134
+ region: "Geneva",
135
+ },
136
+ }
137
+ ],
138
+ },
139
+ "SEARCH": {
140
+ model: "gpt-5-mini",
141
+ reasoning: { effort: "low" },
142
+ tools: [
143
+ {
144
+ type: "web_search_preview",
145
+ user_location: {
146
+ type: "approximate",
147
+ country: "CH",
148
+ city: "Geneva",
149
+ region: "Geneva",
150
+ },
151
+ }
152
+ ],
153
+ },
154
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * LLM Pricing
3
+ *
4
+ * Gère le pricing des modèles.
5
+ * Les mappings de modèles sont dans openai.ts et xai.ts
6
+ */
7
+ import { CompletionUsage } from "openai/resources";
8
+ import { Usage } from "../types";
9
+ import { LLMProvider } from "./config";
10
+ type ModelPricing = {
11
+ input: number;
12
+ cachedInput?: number;
13
+ output: number;
14
+ };
15
+ export declare const modelPricing: Record<string, ModelPricing>;
16
+ export declare function calculateCost(model: string, usage?: CompletionUsage): number;
17
+ export declare function accumulateCost(currentUsage: Usage, model: string, usage?: CompletionUsage): number;
18
+ /**
19
+ * Retourne le mapping des modèles selon le provider
20
+ *
21
+ * @param provider - Provider ('openai' | 'xai') ou instance OpenAI (legacy)
22
+ * @param forceThinking - Force reasoning_effort à high
23
+ */
24
+ export declare function LLM(provider?: LLMProvider | any, forceThinking?: boolean): Record<string, any>;
25
+ export { LLMopenai } from './openai';
26
+ export { LLMxai } from './xai';
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ /**
3
+ * LLM Pricing
4
+ *
5
+ * Gère le pricing des modèles.
6
+ * Les mappings de modèles sont dans openai.ts et xai.ts
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LLMxai = exports.LLMopenai = exports.modelPricing = void 0;
10
+ exports.calculateCost = calculateCost;
11
+ exports.accumulateCost = accumulateCost;
12
+ exports.LLM = LLM;
13
+ const config_1 = require("./config");
14
+ const openai_1 = require("./openai");
15
+ const xai_1 = require("./xai");
16
+ //
17
+ // Pricing par modèle
18
+ // - https://platform.openai.com/docs/pricing#latest-models
19
+ // - https://x.ai/api (pour xAI)
20
+ exports.modelPricing = {
21
+ // OpenAI GPT-4 family
22
+ "gpt-4.5-preview": { input: 0.000075, cachedInput: 0.0000325, output: 0.000125 },
23
+ "gpt-4.1": { input: 0.000002, cachedInput: 0.0000005, output: 0.000008 },
24
+ "gpt-4.1-mini": { input: 0.0000004, cachedInput: 0.0000001, output: 0.0000016 },
25
+ "gpt-4.1-nano": { input: 0.0000001, cachedInput: 0.000000025, output: 0.0000004 },
26
+ "gpt-4o": { input: 0.0000025, cachedInput: 0.00000125, output: 0.00001 },
27
+ "gpt-4o-audio-preview": { input: 0.0000025, output: 0.00001 },
28
+ "gpt-4o-realtime-preview": { input: 0.000005, cachedInput: 0.0000025, output: 0.00002 },
29
+ "gpt-4o-search-preview": { input: 0.000005, cachedInput: 0.0000025, output: 0.00002 },
30
+ "gpt-4o-mini": { input: 0.00000015, cachedInput: 0.000000075, output: 0.0000006 },
31
+ "gpt-4o-mini-audio-preview": { input: 0.00000015, output: 0.0000006 },
32
+ "gpt-4o-mini-realtime-preview": { input: 0.0000006, cachedInput: 0.0000003, output: 0.0000024 },
33
+ "gpt-4o-mini-search-preview": { input: 0.0000015, cachedInput: 0.00000075, output: 0.000006 },
34
+ "gpt-4o-mini-transcribe": { input: 0.0000015, output: 0.000006 },
35
+ // OpenAI GPT-5 family
36
+ "gpt-5": { input: 0.00000125, output: 0.00001 },
37
+ "gpt-5.1": { input: 0.00000125, output: 0.00001 },
38
+ "gpt-5.2": { input: 0.00000175, cachedInput: 0.000000175, output: 0.000014 },
39
+ "gpt-5-mini": { input: 0.00000025, output: 0.000002 },
40
+ "gpt-5-nano": { input: 0.00000005, output: 0.0000004 },
41
+ // OpenAI o-series
42
+ "o1": { input: 0.000015, cachedInput: 0.0000075, output: 0.00006 },
43
+ "o4-mini": { input: 0.0000011, cachedInput: 0.00000055, output: 0.0000044 },
44
+ "o3-mini": { input: 0.0000011, cachedInput: 0.00000055, output: 0.0000044 },
45
+ "o1-mini": { input: 0.0000011, cachedInput: 0.00000055, output: 0.0000044 },
46
+ // OpenAI Embeddings
47
+ "text-embedding-3-small": { input: 0.00000002, output: 0 },
48
+ "text-embedding-3-large": { input: 0.00000013, output: 0 },
49
+ // OpenAI Audio
50
+ "whisper-1": { input: 0.0001, output: 0 }, // per second
51
+ // xAI Grok 4 family (Décembre 2024)
52
+ // https://x.ai/api#pricing - Prix par token ($/1M tokens divisé par 1M)
53
+ "grok-4": { input: 0.000003, cachedInput: 0.000003, output: 0.000015 },
54
+ "grok-4-1-fast-reasoning": { input: 0.0000002, cachedInput: 0.0000002, output: 0.0000005 },
55
+ "grok-4-1-fast-non-reasoning": { input: 0.0000002, cachedInput: 0.0000002, output: 0.0000005 },
56
+ "grok-4-fast-reasoning": { input: 0.0000002, cachedInput: 0.0000002, output: 0.0000005 },
57
+ "grok-4-fast-non-reasoning": { input: 0.0000002, cachedInput: 0.0000002, output: 0.0000005 },
58
+ "grok-code-fast-1": { input: 0.0000002, output: 0.0000015 },
59
+ };
60
+ function calculateCost(model, usage) {
61
+ if (!usage) {
62
+ return 0;
63
+ }
64
+ if (!exports.modelPricing[model]) {
65
+ console.warn(`⚠️ Unknown model for pricing: ${model}`);
66
+ return 0;
67
+ }
68
+ const pricing = exports.modelPricing[model];
69
+ const cost = usage.prompt_tokens * pricing.input +
70
+ usage.completion_tokens * pricing.output;
71
+ return cost;
72
+ }
73
+ function accumulateCost(currentUsage, model, usage) {
74
+ if (!usage) {
75
+ return 0;
76
+ }
77
+ currentUsage.prompt += usage.prompt_tokens || 0;
78
+ currentUsage.completion += usage.completion_tokens || 0;
79
+ currentUsage.total += usage.total_tokens || 0;
80
+ const cost = calculateCost(model, usage);
81
+ currentUsage.cost += cost;
82
+ return currentUsage.cost;
83
+ }
84
+ //
85
+ // Mapping provider → modèles
86
+ const LLMmapping = {
87
+ openai: openai_1.LLMopenai,
88
+ xai: xai_1.LLMxai
89
+ };
90
+ /**
91
+ * Retourne le mapping des modèles selon le provider
92
+ *
93
+ * @param provider - Provider ('openai' | 'xai') ou instance OpenAI (legacy)
94
+ * @param forceThinking - Force reasoning_effort à high
95
+ */
96
+ function LLM(provider, forceThinking) {
97
+ let resolvedProvider;
98
+ //
99
+ // Support legacy: instance OpenAI passée directement
100
+ if (provider && typeof provider === 'object' && provider.baseURL) {
101
+ resolvedProvider = provider.baseURL.includes('x.ai') ? 'xai' : 'openai';
102
+ }
103
+ else if (typeof provider === 'string') {
104
+ resolvedProvider = provider;
105
+ }
106
+ else {
107
+ resolvedProvider = (0, config_1.getDefaultProvider)();
108
+ }
109
+ const mapping = LLMmapping[resolvedProvider] || LLMmapping.openai;
110
+ //
111
+ // Clone pour éviter de muter l'original
112
+ const result = { ...mapping };
113
+ //
114
+ // Force reasoning_effort to high if thinking is enabled
115
+ if (forceThinking) {
116
+ Object.keys(result).forEach(key => {
117
+ if (result[key]?.reasoning_effort) {
118
+ result[key] = { ...result[key], reasoning_effort: "high" };
119
+ }
120
+ });
121
+ }
122
+ return result;
123
+ }
124
+ //
125
+ // Re-export des mappings pour rétrocompatibilité
126
+ var openai_2 = require("./openai");
127
+ Object.defineProperty(exports, "LLMopenai", { enumerable: true, get: function () { return openai_2.LLMopenai; } });
128
+ var xai_2 = require("./xai");
129
+ Object.defineProperty(exports, "LLMxai", { enumerable: true, get: function () { return xai_2.LLMxai; } });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * xAI (Grok) Model Mappings
3
+ *
4
+ * Configuration des modèles pour le provider xAI
5
+ * Note: xAI ne supporte pas les embeddings ni Whisper nativement
6
+ *
7
+ * Modèles disponibles (Décembre 2024):
8
+ * - grok-4: Flagship model ($3.00/$15.00 per 1M tokens)
9
+ * - grok-4-1-fast-reasoning: Fast reasoning ($0.20/$0.50 per 1M tokens)
10
+ * - grok-4-1-fast-non-reasoning: Fast non-reasoning ($0.20/$0.50 per 1M tokens)
11
+ * - grok-4-fast-reasoning: Fast reasoning ($0.20/$0.50 per 1M tokens)
12
+ * - grok-4-fast-non-reasoning: Fast non-reasoning ($0.20/$0.50 per 1M tokens)
13
+ * - grok-code-fast-1: Agentic coding ($0.20/$1.50 per 1M tokens)
14
+ *
15
+ * Pricing: https://x.ai/api#pricing
16
+ */
17
+ export declare const LLMxai: Record<string, any>;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ /**
3
+ * xAI (Grok) Model Mappings
4
+ *
5
+ * Configuration des modèles pour le provider xAI
6
+ * Note: xAI ne supporte pas les embeddings ni Whisper nativement
7
+ *
8
+ * Modèles disponibles (Décembre 2024):
9
+ * - grok-4: Flagship model ($3.00/$15.00 per 1M tokens)
10
+ * - grok-4-1-fast-reasoning: Fast reasoning ($0.20/$0.50 per 1M tokens)
11
+ * - grok-4-1-fast-non-reasoning: Fast non-reasoning ($0.20/$0.50 per 1M tokens)
12
+ * - grok-4-fast-reasoning: Fast reasoning ($0.20/$0.50 per 1M tokens)
13
+ * - grok-4-fast-non-reasoning: Fast non-reasoning ($0.20/$0.50 per 1M tokens)
14
+ * - grok-code-fast-1: Agentic coding ($0.20/$1.50 per 1M tokens)
15
+ *
16
+ * Pricing: https://x.ai/api#pricing
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.LLMxai = void 0;
20
+ exports.LLMxai = {
21
+ // Vision capable models
22
+ "VISION": {
23
+ model: "grok-4",
24
+ temperature: 0.2,
25
+ stream: false
26
+ },
27
+ "VISION-fast": {
28
+ model: "grok-4-fast-reasoning",
29
+ temperature: 0.2,
30
+ stream: false
31
+ },
32
+ // Embedding models - xAI ne supporte pas les embeddings
33
+ // Si utilisé, une erreur sera levée par modelConfig
34
+ // "EMBEDDING-small": undefined,
35
+ // "EMBEDDING-large": undefined,
36
+ // Audio models - xAI ne supporte pas Whisper
37
+ // "WHISPER": undefined,
38
+ // "TRANSCRIBE": undefined,
39
+ // Chat/Responses models
40
+ "LOW-fast": {
41
+ temperature: 0.2,
42
+ model: "grok-code-fast-1",
43
+ stream: true
44
+ },
45
+ "LOW": {
46
+ temperature: 0.2,
47
+ model: "grok-4-fast-non-reasoning",
48
+ stream: true
49
+ },
50
+ "LOW-medium": {
51
+ temperature: 0.2,
52
+ model: "grok-4-fast-non-reasoning",
53
+ stream: true
54
+ },
55
+ "MEDIUM-fast": {
56
+ temperature: 0.2,
57
+ model: "grok-4-1-fast-reasoning",
58
+ stream: true
59
+ },
60
+ "MEDIUM": {
61
+ temperature: 0.2,
62
+ model: "grok-4-fast-reasoning",
63
+ stream: true
64
+ },
65
+ "HIGH-fast": {
66
+ model: "grok-4-1-fast-reasoning",
67
+ temperature: 0.2,
68
+ stream: true
69
+ },
70
+ "HIGH": {
71
+ model: "grok-4",
72
+ temperature: 0.2,
73
+ stream: true
74
+ },
75
+ "HIGH-medium": {
76
+ model: "grok-4",
77
+ temperature: 0.2,
78
+ stream: true
79
+ },
80
+ "SEARCH-fast": {
81
+ temperature: 0.2,
82
+ model: "grok-code-fast-1",
83
+ tools: [{ type: "web_search" }],
84
+ },
85
+ "SEARCH": {
86
+ temperature: 0.2,
87
+ model: "grok-4-fast-reasoning",
88
+ tools: [{ type: "web_search" }],
89
+ },
90
+ };
@@ -1,17 +1,5 @@
1
- import { CompletionUsage } from "openai/resources";
2
- import { Usage } from "./types";
3
- type ModelPricing = {
4
- input: number;
5
- cachedInput?: number;
6
- output: number;
7
- };
8
- export declare const modelPricing: Record<string, ModelPricing>;
9
- export declare function calculateCost(model: string, usage?: CompletionUsage): number;
10
- export declare function accumulateCost(currentUsage: Usage, model: string, usage?: CompletionUsage): number;
11
- export declare function LLM(openai: any, forceThinking?: boolean): any;
12
- export declare const LLMxai: any;
13
1
  /**
14
- * Get model mapping for OpenAI
2
+ * @deprecated Ce fichier est conservé pour rétrocompatibilité.
3
+ * Utiliser les imports depuis './llm/pricing' directement.
15
4
  */
16
- export declare const LLMopenai: any;
17
- export {};
5
+ export { modelPricing, calculateCost, accumulateCost, LLM, LLMxai, LLMopenai, } from './llm/pricing';