-
Notifications
You must be signed in to change notification settings - Fork 2
Add:Added Gemini AI Support #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
b6dcbfb
293f392
eab24c8
c668e17
b0a31f3
4a0e18e
e6dc7d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "models": { | ||
| "gemini-1.5-flash-latest": { | ||
| "prompt": 0.0005, | ||
| "completion": 0.0015 | ||
| }, | ||
| "gemini-1.5-pro-latest": { | ||
| "prompt": 0.0025, | ||
| "completion": 0.0075 | ||
| }, | ||
| "gemini-pro": { | ||
| "prompt": 0.0005, | ||
| "completion": 0.0015 | ||
| } | ||
| }, | ||
| "fallback": { | ||
| "prompt": 0.0005, | ||
| "completion": 0.0015 | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import { OpenAIProvider } from './openai/OpenAIProvider.js'; | ||
| import { GeminiProvider } from './gemini/GeminiProvider.js'; | ||
|
|
||
| /** | ||
| * Creates and configures AI translation providers based on configuration. | ||
|
|
@@ -26,6 +27,8 @@ export class ProviderFactory { | |
| switch (providerName.toLowerCase()) { | ||
| case 'openai': | ||
| return new OpenAIProvider(config, logger); | ||
| case 'gemini': | ||
| return new GeminiProvider(config, logger); | ||
| default: | ||
| throw new Error(`Unsupported provider: ${providerName}. ` + `Supported providers: ${ProviderFactory.getSupportedProviders().join(', ')}`); | ||
| } | ||
|
|
@@ -39,7 +42,7 @@ export class ProviderFactory { | |
| * @return {Array<string>} Array of supported provider names. | ||
| */ | ||
| static getSupportedProviders() { | ||
| return ['openai']; | ||
| return ['openai', 'gemini']; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -76,6 +79,18 @@ export class ProviderFactory { | |
| model: 'gpt-3.5-turbo', | ||
| }, | ||
| }, | ||
| { | ||
| name: 'gemini', | ||
| displayName: 'Google Gemini', | ||
| description: 'Google Gemini models', | ||
| status: 'implemented', | ||
| models: ['gemini-2.5-pro', 'gemini-2.5-flash', 'gemini-2.5-flash-lite'], | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Model names inconsistency across files The models listed here ( Please ensure consistency between:
Consider updating either the pricing config or this provider info to match. 🤖 Prompt for AI Agents |
||
| configExample: { | ||
| provider: 'gemini', | ||
| apiKey: 'your-gemini-api-key', | ||
| model: 'gemini-2.5-flash', | ||
| }, | ||
| }, | ||
| ]; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Gemini API pricing per 1M tokens 2026 official: gemini-2.5-pro, gemini-2.5-flash, gemini-3.1-pro-preview, gemini-flash-latest, gemini-3.1-flash-lite-preview💡 Result:
Gemini API Paid Tier pricing per 1M tokens (USD) as of April 2026 from official Google AI for Developers documentation (standard tier, text/image/video input unless noted; output includes thinking tokens; audio input higher where specified; Pro models tiered by prompt length <=200K / >200K tokens): - gemini-2.5-pro: Input $1.25 / $2.50, Output $10.00 / $15.00 - gemini-2.5-flash: Input $0.30 (text/image/video), $1.00 (audio); Output $2.50 - gemini-3.1-pro-preview: Input $2.00 / $4.00, Output $12.00 / $18.00 - gemini-flash-latest: Likely maps to latest stable Flash such as gemini-2.5-flash or gemini-3-flash-preview at Input $0.30-$0.50 / Output $2.50-$3.00 (exact alias pricing follows underlying model; no explicit separate rate found) - gemini-3.1-flash-lite-preview: Input $0.25 (text/image/video), $0.50 (audio); Output $1.50 Free tier available with limits (e.g., requests per day). Context caching and grounding extra. Batch/Priority tiers offer discounts/multipliers. Prices from ai.google.dev/gemini-api/docs/pricing (results 1,17+), Vertex AI docs (4,9,10), and consistent secondary confirmations (2,20,23,26,29). Vertex AI matches Developer API standard rates. "gemini-flash-latest" points to latest Flash release (e.g., 2.5 Flash per models docs), using 2.5 Flash rates conservatively as most cited stable.
Citations:
Pricing values are significantly below Google's published rates — cost estimates and
--max-costenforcement will be inaccurate.Per Google's official Gemini API pricing (April 2026), the per‑1K-token costs in this file are 2–10× lower than reality:
Since
GeminiProvider.calculateCost()and dry‑run estimation read directly from this config (and the README pricing tables mirror it), a user who sets--max-cost 5.00could be billed multiples of that on real runs. Note also that 2.5 Pro and 3.1 Pro have a long‑context (>200K tokens) tier at 2× — worth documenting if not modeling.📐 Corrected values (from official ai.google.dev/gemini-api/docs/pricing)
"models": { "gemini-2.5-pro": { - "prompt": 0.0005, - "completion": 0.0015 + "prompt": 0.00125, + "completion": 0.01 }, "gemini-2.5-flash": { - "prompt": 0.000175, - "completion": 0.000525 + "prompt": 0.0003, + "completion": 0.0025 }, "gemini-3.1-pro-preview": { - "prompt": 0.00125, - "completion": 0.005 + "prompt": 0.002, + "completion": 0.012 }, "gemini-flash-latest": { - "prompt": 0.000175, - "completion": 0.000525 + "prompt": 0.0003, + "completion": 0.0025 }, "gemini-3.1-flash-lite-preview": { - "prompt": 0.0000375, - "completion": 0.00015 + "prompt": 0.00025, + "completion": 0.0015 } }, "fallback": { - "prompt": 0.0005, - "completion": 0.0015 + "prompt": 0.00125, + "completion": 0.01 } }🤖 Prompt for AI Agents