Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/api/providers/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl
const response = await this.client.models.countTokens({
model,
contents: convertAnthropicContentToGemini(content),
config: {
httpOptions: this.options.googleGeminiBaseUrl
? { baseUrl: this.options.googleGeminiBaseUrl }
: undefined,
},
Comment on lines +264 to +268
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change adds support for custom base URL in countTokens, but there are no tests covering this method. The test file (gemini.spec.ts) has comprehensive tests for createMessage and completePrompt, but countTokens is not tested at all. Consider adding a test that verifies the httpOptions.baseUrl is properly passed when googleGeminiBaseUrl is set, similar to the existing test at line 122-124 in gemini.spec.ts for completePrompt.

})

if (response.totalTokens === undefined) {
Expand Down