fourmis-agents-sdk 0.2.4 → 0.2.6

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.
@@ -163,13 +163,79 @@ function findOpenAIPricing(model) {
163
163
  }
164
164
  return bestPricing;
165
165
  }
166
+ var GEMINI_PRICING = {
167
+ "gemini-2.5-pro": {
168
+ inputPerMillion: 1.25,
169
+ outputPerMillion: 10,
170
+ cacheReadPerMillion: 0.315
171
+ },
172
+ "gemini-2.5-flash": {
173
+ inputPerMillion: 0.15,
174
+ outputPerMillion: 0.6,
175
+ cacheReadPerMillion: 0.0375
176
+ },
177
+ "gemini-2.5-flash-lite": {
178
+ inputPerMillion: 0.075,
179
+ outputPerMillion: 0.3
180
+ },
181
+ "gemini-2.0-flash": {
182
+ inputPerMillion: 0.1,
183
+ outputPerMillion: 0.4,
184
+ cacheReadPerMillion: 0.025
185
+ },
186
+ "gemini-2.0-flash-lite": {
187
+ inputPerMillion: 0.075,
188
+ outputPerMillion: 0.3
189
+ }
190
+ };
191
+ var GEMINI_CONTEXT_WINDOWS = {
192
+ "gemini-2.5-pro": 1048576,
193
+ "gemini-2.5-flash": 1048576,
194
+ "gemini-2.5-flash-lite": 1048576,
195
+ "gemini-2.0-flash": 1048576,
196
+ "gemini-2.0-flash-lite": 1048576
197
+ };
198
+ var GEMINI_MAX_OUTPUT = {
199
+ "gemini-2.5-pro": 65536,
200
+ "gemini-2.5-flash": 65536,
201
+ "gemini-2.5-flash-lite": 65536,
202
+ "gemini-2.0-flash": 8192,
203
+ "gemini-2.0-flash-lite": 8192
204
+ };
205
+ function calculateGeminiCost(model, usage) {
206
+ const pricing = findGeminiPricing(model);
207
+ if (!pricing)
208
+ return 0;
209
+ const inputCost = usage.inputTokens / 1e6 * pricing.inputPerMillion;
210
+ const outputCost = usage.outputTokens / 1e6 * pricing.outputPerMillion;
211
+ const cacheReadCost = usage.cacheReadInputTokens / 1e6 * (pricing.cacheReadPerMillion ?? pricing.inputPerMillion);
212
+ return inputCost + outputCost + cacheReadCost;
213
+ }
214
+ function findGeminiPricing(model) {
215
+ if (GEMINI_PRICING[model])
216
+ return GEMINI_PRICING[model];
217
+ let bestKey = "";
218
+ let bestPricing;
219
+ for (const [key, pricing] of Object.entries(GEMINI_PRICING)) {
220
+ if (model.startsWith(key) && key.length > bestKey.length) {
221
+ bestKey = key;
222
+ bestPricing = pricing;
223
+ }
224
+ }
225
+ return bestPricing;
226
+ }
166
227
  export {
167
228
  findOpenAIPricing,
229
+ findGeminiPricing,
168
230
  calculateOpenAICost,
231
+ calculateGeminiCost,
169
232
  calculateAnthropicCost,
170
233
  OPENAI_PRICING,
171
234
  OPENAI_MAX_OUTPUT,
172
235
  OPENAI_CONTEXT_WINDOWS,
236
+ GEMINI_PRICING,
237
+ GEMINI_MAX_OUTPUT,
238
+ GEMINI_CONTEXT_WINDOWS,
173
239
  ANTHROPIC_PRICING,
174
240
  ANTHROPIC_MAX_OUTPUT,
175
241
  ANTHROPIC_CONTEXT_WINDOWS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fourmis-agents-sdk",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Multi-provider AI agent SDK with direct API access and in-process tool execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,6 +9,14 @@
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.js"
12
+ },
13
+ "./auth/openai": {
14
+ "types": "./dist/auth/openai-oauth.d.ts",
15
+ "import": "./dist/auth/openai-oauth.js"
16
+ },
17
+ "./auth/gemini": {
18
+ "types": "./dist/auth/gemini-oauth.d.ts",
19
+ "import": "./dist/auth/gemini-oauth.js"
12
20
  }
13
21
  },
14
22
  "files": [
@@ -54,6 +62,7 @@
54
62
  },
55
63
  "dependencies": {
56
64
  "@anthropic-ai/sdk": "^0.39.0",
65
+ "@google/genai": "^1.40.0",
57
66
  "@modelcontextprotocol/sdk": "^1.26.0",
58
67
  "openai": "^6.21.0",
59
68
  "zod": "^3.24.0"