KosmoKrator

ai

Google Gemini CLI for AI Agents

Use the Google Gemini CLI from KosmoKrator to call Google Gemini tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 6 read 1 write API key auth

Google Gemini CLI Setup

Google Gemini can be configured headlessly with `kosmokrator integrations:configure google-gemini`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure google-gemini --set api_key="$GOOGLE_GEMINI_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor google-gemini --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_key GOOGLE_GEMINI_API_KEY Secret secret yes API Key
url GOOGLE_GEMINI_URL URL url no API Base URL

Call Google Gemini Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call google-gemini.gemini_list_models '{
  "pageSize": 1,
  "pageToken": "example_pageToken"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:google-gemini gemini_list_models '{
  "pageSize": 1,
  "pageToken": "example_pageToken"
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs google-gemini --json
kosmo integrations:docs google-gemini.gemini_list_models --json
kosmo integrations:schema google-gemini.gemini_list_models --json
kosmo integrations:search "Google Gemini" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Google Gemini.

google-gemini.gemini_list_models

Read read

List available Gemini AI models. Returns model names, display names, supported generation methods, and other metadata.

Parameters
pageSize, pageToken

Generic CLI call

kosmo integrations:call google-gemini.gemini_list_models '{"pageSize":1,"pageToken":"example_pageToken"}' --json

Provider shortcut

kosmo integrations:google-gemini gemini_list_models '{"pageSize":1,"pageToken":"example_pageToken"}' --json

google-gemini.gemini_get_model

Read read

Get detailed information about a specific Gemini model, including supported generation methods, input/output token limits, and capabilities.

Parameters
id

Generic CLI call

kosmo integrations:call google-gemini.gemini_get_model '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:google-gemini gemini_get_model '{"id":"example_id"}' --json

google-gemini.gemini_generate_content

Write write

Generate content using a Gemini model. Send text prompts and receive AI-generated responses. Supports configurable generation parameters like temperature, topP, and maxOutputTokens.

Parameters
id, contents, temperature, topP, maxOutputTokens

Generic CLI call

kosmo integrations:call google-gemini.gemini_generate_content '{"id":"example_id","contents":"example_contents","temperature":1,"topP":1,"maxOutputTokens":1}' --json

Provider shortcut

kosmo integrations:google-gemini gemini_generate_content '{"id":"example_id","contents":"example_contents","temperature":1,"topP":1,"maxOutputTokens":1}' --json

google-gemini.gemini_list_files

Read read

List files uploaded to the Gemini File API. Returns file names, MIME types, sizes, and states.

Parameters
pageSize, pageToken

Generic CLI call

kosmo integrations:call google-gemini.gemini_list_files '{"pageSize":1,"pageToken":"example_pageToken"}' --json

Provider shortcut

kosmo integrations:google-gemini gemini_list_files '{"pageSize":1,"pageToken":"example_pageToken"}' --json

google-gemini.gemini_get_file

Read read

Get metadata for an uploaded file in the Gemini File API, including its name, display name, MIME type, size, and processing state.

Parameters
id

Generic CLI call

kosmo integrations:call google-gemini.gemini_get_file '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:google-gemini gemini_get_file '{"id":"example_id"}' --json

google-gemini.gemini_list_tuned_models

Read read

List tuned (fine-tuned) Gemini models in your project. Returns model names, base models, tuning tasks, and display names.

Parameters
pageSize, pageToken

Generic CLI call

kosmo integrations:call google-gemini.gemini_list_tuned_models '{"pageSize":1,"pageToken":"example_pageToken"}' --json

Provider shortcut

kosmo integrations:google-gemini gemini_list_tuned_models '{"pageSize":1,"pageToken":"example_pageToken"}' --json

google-gemini.gemini_get_current_user

Read read

Get information about the currently authenticated Google user, including permissions and account details.

Parameters
none

Generic CLI call

kosmo integrations:call google-gemini.gemini_get_current_user '{}' --json

Provider shortcut

kosmo integrations:google-gemini gemini_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

google-gemini.gemini_list_models

List available Gemini AI models. Returns model names, display names, supported generation methods, and other metadata.

Operation
Read read
Schema command
kosmo integrations:schema google-gemini.gemini_list_models --json
ParameterTypeRequiredDescription
pageSize integer no Maximum number of models to return per page (default: 50, max: 100).
pageToken string no Token from a previous response to fetch the next page of results.

google-gemini.gemini_get_model

Get detailed information about a specific Gemini model, including supported generation methods, input/output token limits, and capabilities.

Operation
Read read
Schema command
kosmo integrations:schema google-gemini.gemini_get_model --json
ParameterTypeRequiredDescription
id string yes The model resource name (e.g., "models/gemini-2.0-flash" or "models/gemini-pro").

google-gemini.gemini_generate_content

Generate content using a Gemini model. Send text prompts and receive AI-generated responses. Supports configurable generation parameters like temperature, topP, and maxOutputTokens.

Operation
Write write
Schema command
kosmo integrations:schema google-gemini.gemini_generate_content --json
ParameterTypeRequiredDescription
id string yes The model resource name (e.g., "models/gemini-2.0-flash" or "models/gemini-pro").
contents array yes Array of content parts. Each entry should have a "role" ("user" or "model") and "parts" array with objects like {"text": "Your prompt here"}.
temperature number no Controls randomness in generation (0.0–2.0). Lower values are more deterministic, higher values more creative.
topP number no Nucleus sampling parameter (0.0–1.0). Limits cumulative probability of tokens considered.
maxOutputTokens integer no Maximum number of tokens to generate in the response.

google-gemini.gemini_list_files

List files uploaded to the Gemini File API. Returns file names, MIME types, sizes, and states.

Operation
Read read
Schema command
kosmo integrations:schema google-gemini.gemini_list_files --json
ParameterTypeRequiredDescription
pageSize integer no Maximum number of files to return per page (default: 50, max: 100).
pageToken string no Token from a previous response to fetch the next page of results.

google-gemini.gemini_get_file

Get metadata for an uploaded file in the Gemini File API, including its name, display name, MIME type, size, and processing state.

Operation
Read read
Schema command
kosmo integrations:schema google-gemini.gemini_get_file --json
ParameterTypeRequiredDescription
id string yes The file resource name (e.g., "files/abc123").

google-gemini.gemini_list_tuned_models

List tuned (fine-tuned) Gemini models in your project. Returns model names, base models, tuning tasks, and display names.

Operation
Read read
Schema command
kosmo integrations:schema google-gemini.gemini_list_tuned_models --json
ParameterTypeRequiredDescription
pageSize integer no Maximum number of tuned models to return per page (default: 50, max: 100).
pageToken string no Token from a previous response to fetch the next page of results.

google-gemini.gemini_get_current_user

Get information about the currently authenticated Google user, including permissions and account details.

Operation
Read read
Schema command
kosmo integrations:schema google-gemini.gemini_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.