Skip to main content

llm-gemini-code-assist

PyPI Changelog Tests License

API access to Google's Gemini models via the Code Assist API with OAuth authentication.

This is a fork of llm-gemini modified to use Google's Code Assist API, which requires OAuth authentication instead of API keys.

Installation

Install this plugin in the same environment as LLM:

llm install llm-gemini-code-assist

Authentication

Unlike the standard llm-gemini plugin, this version uses OAuth authentication with the Code Assist API. Authentication generally is automatic if you have gemini-cli installed; else, you can authenticate manually:

llm gemini-ca auth

This will:

  1. Open your browser to Google's OAuth consent page
  2. After you approve, save credentials to ~/.gemini/oauth_creds.json
  3. The credentials include a refresh token for automatic renewal

The OAuth credentials are stored with file permissions 0600 for security.

Usage

Once authenticated, use the models with the gemini-ca/ prefix:

llm -m gemini-ca/gemini-2.5-flash "Tell me a joke about a pelican"

You can set it as your default model:

llm models default gemini-ca/gemini-2.5-flash
llm "Tell me a joke about a pelican"

Available Models

Models available via Code Assist API with the gemini-ca/ prefix:

  • gemini-ca/gemini-3-pro-preview - Gemini 3 Pro (preview)
  • gemini-ca/gemini-3-flash-preview - Gemini 3 Flash (preview)
  • gemini-ca/gemini-2.5-pro - Gemini 2.5 Pro
  • gemini-ca/gemini-2.5-flash - Gemini 2.5 Flash
  • gemini-ca/gemini-2.5-flash-lite - Gemini 2.5 Flash Lite

See gemini-cli model configs for the canonical model list.

Model Latency

Typical response times for a simple prompt (tested January 2026):

Model Avg (ms) Notes
gemini-2.5-flash-lite ~1200 Fastest
gemini-2.5-flash ~1500
gemini-3-flash-preview ~1900 Preview
gemini-2.5-pro ~4000 High variance
gemini-3-pro-preview ~4500 Preview

Note: Code Assist API has rate limits (~3 requests/minute). Use scripts/profile_request.py to benchmark.

Features

All features from llm-gemini are supported:

Multi-modal Input

llm -m gemini-ca/gemini-2.5-flash 'describe image' -a image.jpg

JSON Output

llm -m gemini-ca/gemini-2.5-flash -o json_object 1 \
  '3 largest cities in California'

Code Execution

llm -m gemini-ca/gemini-2.0-flash -o code_execution 1 \
  'calculate factorial of 13'

Google Search

llm -m gemini-ca/gemini-2.5-flash -o google_search 1 \
  'What happened today?'

Chat

llm chat -m gemini-ca/gemini-2.5-flash

Troubleshooting

If you get authentication errors:

  1. Check if your credentials are expired:

    cat ~/.gemini/oauth_creds.json | python -m json.tool
    
  2. Re-authenticate:

    llm gemini-ca auth
    

Development

To set up the development environment:

cd llm-gemini-code-assist
uv sync
uv run pre-commit install

This installs dependencies and sets up pre-commit hooks (including secret scanning).

Run tests:

uv run pytest

The pre-commit hooks will automatically run linting, formatting, type checking, and secret scanning before each commit. You can also run them manually:

uv run pre-commit run --all-files

Releasing

Releases are tag-driven and automated via GitHub Actions.

# 1. Ensure tests pass
uv run pytest

# 2. Create and push a version tag (triggers release workflow)
git tag v0.27.0
git push origin v0.27.0

This will automatically build the package, create a GitHub Release with changelog, and publish to PyPI.

Differences from llm-gemini

  • Uses OAuth authentication instead of API keys
  • Requires Code Assist API access
  • Models use gemini-ca/ prefix
  • Tokens auto-refresh using stored refresh tokens

License

Apache 2.0

Metadata

Release files for llm-gemini-code-assist 0.28.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-gemini-code-assist 0.28.2
File Size Uploaded
llm_gemini_code_assist-0.28.2.tar.gz 141.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-gemini-code-assist 0.28.2
File Interpreter ABI Platform
llm_gemini_code_assist-0.28.2-py3-none-any.whl Python 3 none any Details

Total release size: 159.4 kB

Release files / llm_gemini_code_assist-0.28.2.tar.gz

Download URL llm_gemini_code_assist-0.28.2.tar.gz
Size 141.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fbd4b6d0ed032f6d405f5d8dec9ff29f6503c3c873d754d01e92449f32e8155b
BLAKE2b-256 checksum
How to use checksums
72aac6324e93e18efa8f7db4185eb78f523ab856548b11dbd0cf3dc62e23274d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 4, 2026.

Transparency log

Release files / llm_gemini_code_assist-0.28.2-py3-none-any.whl

Download URL llm_gemini_code_assist-0.28.2-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bd0460d3a2e89a94673baf327ccc787a363196d49c9072bea87d1ce549e5c8e
BLAKE2b-256 checksum
How to use checksums
400e057e962cc703d0716776da45465ebba956b5abeb13a8807bf239519cbd37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.28.2 This release

2 release files

0.26.4

2 release files

0.26.3

2 release files

0.26.2

2 release files

0.26.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page