Skip to content

Add Google provider with generateContent protocol#225

Open
aisk wants to merge 4 commits into
vercel-labs:mainfrom
aisk:google-provider
Open

Add Google provider with generateContent protocol#225
aisk wants to merge 4 commits into
vercel-labs:mainfrom
aisk:google-provider

Conversation

@aisk

@aisk aisk commented Jul 19, 2026

Copy link
Copy Markdown

Adds a Google Gemini provider following the Anthropic provider's pattern: the official google-genai SDK handles transport, and the protocol layer does the message/params translation.

  • GoogleProvider (handles google / @ai-sdk/google) with a lazily-created genai.Client, GOOGLE_GENERATIVE_AI_API_KEY/GEMINI_API_KEY/GOOGLE_API_KEY env fallbacks, list_models(), and probe(). google-genai>=2.0.0 ships as the ai[google] extra.
  • GoogleGenerateContentProtocol streams via generate_content_stream, mapping text/thought parts, function calls, code-execution parts, inline data, and usage into framework events. thought_signature round-trips through provider metadata so multi-turn function calling works with thinking models.
  • Reasoning effort maps to thinking_level on Gemini 3 and to a token budget on earlier models, which reject thinking_level.
  • Built-in tool factories: google_search, url_context, code_execution.
  • Transport errors are mapped into the provider error hierarchy (the SDK doesn't wrap httpx errors), and safety-blocked prompts raise instead of yielding an empty message.

Verified against the live Gemini API: text, tool-call round-trip, structured output, thinking on 2.5/3, and error mapping.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

@aisk is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@socket-security

socket-security Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​google-genai@​2.12.181100100100100

View full report

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