Skip to content

feat: add gemini provider#1

Merged
fabienpiette merged 8 commits into
mainfrom
feat/use-gemini-provider
Feb 11, 2026
Merged

feat: add gemini provider#1
fabienpiette merged 8 commits into
mainfrom
feat/use-gemini-provider

Conversation

@fabienpiette

@fabienpiette fabienpiette commented Jan 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add Google Gemini as an alternative AI provider for both transcription and post-processing, alongside the existing OpenAI support
  • Implement automatic provider fallback — when both API keys are configured, goscribe switches to the alternate provider on failure (rate limits, API errors)
  • Add rate limit handling with exponential backoff and inter-chunk delays

Changes

New Gemini provider (main.go):

  • Native Gemini audio transcription via inline base64-encoded audio data
  • Gemini text generation for post-processing actions
  • MIME type detection for audio files (mp3, wav, ogg, flac, aac, etc.)
  • Gemini-specific context limits (up to 900K tokens for Gemini 1.5/2.0)
  • 20MB file size limit for Gemini (vs 25MB for OpenAI)

Provider management:

  • -provider flag to select openai or gemini per invocation
  • -set-provider to persist the default in config
  • -gemini-key / -set-gemini-key for Gemini API key management
  • -no-fallback flag to disable automatic provider switching

Resilience:

  • Exponential backoff with retry on rate-limited requests
  • Parses retry-after from API error responses
  • Inter-chunk delays to prevent hitting rate limits during large file processing

Tests (main_test.go):

  • 475 new lines of tests covering provider selection, Gemini key storage, MIME type detection, config validation, and model context limits

Docs (README.md):

  • Updated with dual-provider usage, new CLI options table, provider comparison, fallback behavior, and rate limit documentation

Test plan

  • Run make test to verify all unit tests pass
  • Test transcription with OpenAI provider (goscribe meeting.mp3)
  • Test transcription with Gemini provider (goscribe -provider gemini meeting.mp3)
  • Test fallback behavior with an invalid OpenAI key but valid Gemini key
  • Test -no-fallback correctly disables provider switching
  • Test -set-gemini-key and -set-provider persist to config

@fabienpiette fabienpiette merged commit ad13eaa into main Feb 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant