MCPcopy Create free account

hub / github.com/GewoonJaap/gemini-cli-openai / functions

Functions83 in github.com/GewoonJaap/gemini-cli-openai

↓ 7 callersMethodinitializeAuth
* Initializes authentication using OAuth2 credentials with KV storage caching.
src/auth.ts:49
↓ 3 callersMethodcreateCustomOnlyConfig
(customTools: Tool[])
src/helpers/native-tools-manager.ts:108
↓ 3 callersMethodextractBooleanParam
(options: Record<string, unknown> | undefined, key: string)
src/gemini-client.ts:891
↓ 3 callersMethodgetFallbackModel
* Gets the fallback model for the given original model. * Returns null if no fallback is configured for the model.
src/helpers/auto-model-switching.ts:26
↓ 3 callersMethodisEnabled
* Checks if auto model switching is enabled via environment variable.
src/helpers/auto-model-switching.ts:18
↓ 3 callersFunctionisMediaTypeSupported
(modelId: string, supportKey: keyof ModelInfo)
src/utils/validation.ts:13
↓ 3 callersMethodshouldEnableGoogleSearch
(params: NativeToolsRequestParams)
src/helpers/native-tools-manager.ts:119
↓ 3 callersFunctionvalidateContent
( type: string, content: MessageContent )
src/utils/validation.ts:40
↓ 2 callersMethodcacheTokenInKV
* Cache the access token in KV storage.
src/auth.ts:180
↓ 2 callersMethodclearTokenCache
* Clear cached token from KV storage.
src/auth.ts:208
↓ 2 callersMethodcreateSwitchNotification
* Creates a notification message for when a model switch occurs.
src/helpers/auto-model-switching.ts:57
↓ 2 callersMethodcreateThinkingConfig
* Creates a thinkingConfig object for Gemini 2.5 models (uses thinkingBudget). * @param budget - The thinking budget (0 = disabled, -1 = dynamic, po
src/helpers/generation-config-validator.ts:83
↓ 2 callersMethoddiscoverProjectId
* Discovers the Google Cloud project ID. Uses the environment variable if provided.
src/gemini-client.ts:115
↓ 2 callersFunctionencodeSignatureInToolCallId
(signature: string | undefined)
src/helpers/thought-signature.ts:10
↓ 2 callersFunctiongetAllModelIds
()
src/models.ts:94
↓ 2 callersMethodgetCompletion
* Get a complete response from Gemini API (non-streaming).
src/gemini-client.ts:801
↓ 2 callersMethodisRateLimitStatus
* Checks if the HTTP status code indicates a rate limit error.
src/helpers/auto-model-switching.ts:43
↓ 2 callersMethodisValidEffortLevel
* Type guard to check if a value is a valid EffortLevel. * @param value - The value to check * @returns True if the value is a valid EffortLevel
src/helpers/generation-config-validator.ts:73
↓ 2 callersMethodprocessChunk
(textChunk: string, metadata?: GroundingMetadata)
src/helpers/citations-processor.ts:43
↓ 2 callersMethodshouldEnableUrlContext
(params: NativeToolsRequestParams)
src/helpers/native-tools-manager.ts:125
↓ 2 callersMethodstreamContent
* Stream content from Gemini API.
src/gemini-client.ts:351
↓ 2 callersFunctionvalidateModel
(modelId: string)
src/utils/validation.ts:23
↓ 2 callersMethodvalidateThinkingBudget
* Validates and corrects the thinking budget for a specific model. * @param modelId - The Gemini model ID * @param thinkingBudget - The requested
src/helpers/generation-config-validator.ts:181
↓ 1 callersMethodcallEndpoint
* A generic method to call a Code Assist API endpoint.
src/auth.ts:246
↓ 1 callersMethodcleanSchema
* Recursively cleans a schema object to remove fields not supported by Gemini * (like keys starting with $, strict, const, etc.) * @param schema -
src/helpers/generation-config-validator.ts:114
↓ 1 callersMethodcreateFinalToolConfiguration
( config: NativeToolsConfiguration, options: Partial<ChatCompletionRequest> = {} )
src/helpers/generation-config-validator.ts:327
↓ 1 callersMethodcreateGemini3ThinkingConfig
* Creates a thinkingConfig object for Gemini 3 models (uses thinkingLevel). * * Gemini 3 models use thinkingLevel instead of thinkingBudget. * U
src/helpers/generation-config-validator.ts:101
↓ 1 callersMethodcreateNativeToolsArray
* Creates the array of native tools to be sent to the Gemini API.
src/helpers/native-tools-manager.ts:55
↓ 1 callersFunctioncreateOpenAIStreamTransformer
(model: string)
src/stream-transformer.ts:85
↓ 1 callersMethodcreateSafetySettings
* Creates safety settings configuration for Gemini API. * @param env - Environment variables containing safety thresholds * @returns Safety settin
src/helpers/generation-config-validator.ts:141
↓ 1 callersMethodcreateSearchAndUrlConfig
( requestParams: NativeToolsRequestParams, customTools: Tool[], modelId: string )
src/helpers/native-tools-manager.ts:79
↓ 1 callersMethodcreateValidateTools
(options: Partial<ChatCompletionRequest> = {})
src/helpers/generation-config-validator.ts:292
↓ 1 callersMethodcreateValidatedConfig
* Creates a validated generation config for a specific model. * @param modelId - The Gemini model ID * @param options - Generation options includi
src/helpers/generation-config-validator.ts:214
↓ 1 callersMethoddetermineToolConfiguration
* Determines the final tool configuration based on environment settings, * request parameters, and tool compatibility rules.
src/helpers/native-tools-manager.ts:30
↓ 1 callersFunctionencodeImageToBase64
(imagePath)
examples/image-example.js:16
↓ 1 callersMethodextractNativeToolsParams
(options?: Record<string, unknown>)
src/gemini-client.ts:878
↓ 1 callersMethodextractSearchQueries
* Extracts search queries that were used to generate the grounded response.
src/helpers/citations-processor.ts:101
↓ 1 callersFunctionextractSignatureFromToolCallId
(toolCallId: string | undefined)
src/helpers/thought-signature.ts:25
↓ 1 callersMethodextractSourceList
* Extracts a structured list of sources with IDs, titles, and URIs.
src/helpers/citations-processor.ts:108
↓ 1 callersMethodextractStringParam
( options: Record<string, unknown> | undefined, key: string, guard: (v: string) => v is T )
src/gemini-client.ts:899
↓ 1 callersMethodfindSafeInsertionPoint
* Finds a "safe" insertion point for a citation to avoid breaking words or URLs. * It searches for the nearest whitespace or punctuation after the g
src/helpers/citations-processor.ts:19
↓ 1 callersMethodgenerateReasoningOutput
* Generates reasoning output for thinking models.
src/gemini-client.ts:468
↓ 1 callersMethodgetAccessToken
* Get the current access token.
src/auth.ts:276
↓ 1 callersMethodgetCachedTokenInfo
* Get cached token info from KV storage.
src/auth.ts:220
↓ 1 callersMethodhandleNonStreamingFallback
* Handles rate limit fallback for non-streaming requests. * This method requires a stream content function to perform the actual retry.
src/helpers/auto-model-switching.ts:65
↓ 1 callersFunctionisGeminiFunctionCall
(data: unknown)
src/stream-transformer.ts:70
↓ 1 callersMethodisLegacyModel
(modelId: string)
src/helpers/native-tools-manager.ts:131
↓ 1 callersFunctionisNativeToolResponse
(data: unknown)
src/stream-transformer.ts:77
↓ 1 callersMethodisRateLimitError
* Checks if the error message indicates a rate limit error that should trigger auto switching.
src/helpers/auto-model-switching.ts:33
↓ 1 callersFunctionisReasoningData
(data: unknown)
src/stream-transformer.ts:66
↓ 1 callersFunctionisUsageData
(data: unknown)
src/stream-transformer.ts:74
↓ 1 callersFunctionmain
()
examples/image-example.js:123
↓ 1 callersMethodmapEffortToThinkingBudget
* Maps reasoning effort to thinking budget based on model type. * @param effort - The reasoning effort level * @param modelId - The model ID to de
src/helpers/generation-config-validator.ts:25
↓ 1 callersMethodmapEffortToThinkingLevel
* Maps reasoning effort to a Gemini 3 thinkingLevel based on model type. * * Gemini 3 uses thinkingLevel instead of thinkingBudget. The two parame
src/helpers/generation-config-validator.ts:62
↓ 1 callersMethodmessageToGeminiFormat
* Converts a message to Gemini format, handling both text and image content.
src/gemini-client.ts:191
↓ 1 callersMethodparseEnvironmentSettings
(env: Env)
src/helpers/native-tools-manager.ts:135
↓ 1 callersMethodparseSSEStream
* Parses a server-sent event (SSE) stream from the Gemini API.
src/gemini-client.ts:149
↓ 1 callersMethodperformStreamRequest
* Performs the actual stream request with retry logic for 401 errors and auto model switching for rate limits.
src/gemini-client.ts:563
↓ 1 callersMethodrefreshAndCacheToken
* Refresh the OAuth token and cache it in KV storage.
src/auth.ts:121
↓ 1 callersFunctiontestImageWithGemini
(imageDataUrl, question = "What do you see in this image?")
examples/image-example.js:47
↓ 1 callersFunctionvalidateImageUrl
(imageUrl: string)
src/utils/image-utils.ts:26
↓ 1 callersFunctionvalidatePdfBase64
(base64String: string)
src/utils/pdf-utils.ts:8
Methodconstructor
(env: Env, authManager: AuthManager)
src/gemini-client.ts:106
Methodconstructor
(env: Env)
src/auth.ts:42
Methodconstructor
(env: Env)
src/helpers/auto-model-switching.ts:11
Methodconstructor
(env: Env)
src/helpers/citations-processor.ts:11
Methodconstructor
(env: Env)
src/helpers/native-tools-manager.ts:21
MethodcreateGroundingSummary
* Creates a summary of the grounding information for debugging/logging.
src/helpers/citations-processor.ts:126
FunctionestimateImageTokens
(imageUrl: string, detail: "low" | "high" | "auto" = "auto")
src/utils/image-utils.ts:98
Functionflush
(controller)
src/stream-transformer.ts:181
FunctiongetModelInfo
(modelId: string)
src/models.ts:90
MethodgetSearchEntryPoint
* Generates search entry point HTML if available and enabled.
src/helpers/citations-processor.ts:119
FunctionisTextContent
(content: MessageContent)
src/gemini-client.ts:92
FunctionisValidModel
(modelId: string)
src/models.ts:98
FunctionloggingMiddleware
(c: Context<{ Bindings: Env }>, next: Next)
src/middlewares/logging.ts:12
FunctionmodelSupportsImages
(modelId: string, models: ModelRegistry)
src/utils/image-utils.ts:90
FunctionopenAIApiKeyAuth
(c, next)
src/middlewares/auth.ts:8
FunctionparseDataUrl
(dataUrl: string)
src/utils/image-utils.ts:76
MethodprocessCitationsInText
* Processes text to add inline citations if enabled.
src/helpers/native-tools-manager.ts:75
MethodprocessGroundingMetadata
* Processes grounding metadata from the Gemini API response.
src/helpers/native-tools-response-processor.ts:28
MethodprocessNativeToolResponse
* Processes a single part from the Gemini API response and returns a * structured native tool response if the part is a native tool output.
src/helpers/native-tools-response-processor.ts:13
MethodshouldAttemptFallback
* Determines if fallback should be attempted for the given model and conditions.
src/helpers/auto-model-switching.ts:50
Functiontransform
(chunk, controller)
src/stream-transformer.ts:95