Skip to content

Conversation

Copy link

Copilot AI commented Dec 12, 2025

Developers need to specify custom API versions (e.g., v1alpha) when using the Gemini service, matching the @google/genai library interface.

Changes

  • Type definition: Added optional apiVersion?: string field to GeminiClientOptions with JSDoc
  • Client implementation: Store and forward apiVersion to GoogleGenAI constructor in both _sendMessage and getEmbedding methods
  • Tests: Added test coverage for clients with and without apiVersion specified

Usage

const client = new GeminiClient({
  apiKey: 'your-api-key',
  baseUrl: 'https://api.example.com',
  features: ['chat'],
  historyManager: DefaultHistoryManager,
  apiVersion: 'v1alpha'  // Optional - uses SDK default if unset
});

Backward compatible - existing code without apiVersion continues to use SDK defaults.

Original prompt

This section details on the original issue you should resolve

<issue_title>Support specifying apiVersion in Gemini API config</issue_title>
<issue_description>Add support for configuring the Gemini API version via the apiVersion field in configuration options, similar to the interface used in the genai library.

Developers should be able to specify a custom API version for the Gemini service when initializing the client. If not set, the default API version should be left blank and use the SDK default.

Reference: chatgpt-plugin#822


Example reference from genai:

export interface GoogleGenAIOptions {
  ...
  /** Optional. The API version to use. 
   * If unset, the default API version will be used. 
   */
  apiVersion?: string;
  ...
}

Acceptance Criteria:

  • The apiVersion field is supported in the config for Gemini API.
  • If apiVersion is unset or blank, the default SDK behavior is to be used.
  • Documentation is updated to clarify usage of apiVersion for Gemini API.

See also chatgpt-plugin issue 822 for the motivating scenario.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: ikechan8370 <21212372+ikechan8370@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for specifying apiVersion in Gemini API config Add apiVersion configuration support for Gemini API client Dec 12, 2025
Copilot AI requested a review from ikechan8370 December 12, 2025 09:06
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.

Support specifying apiVersion in Gemini API config

2 participants