Skip to main content

gento

A lightweight LLM client.

Features

  • Unified Client Interface: Interact with multiple LLM providers (Gemini, OpenAI, Volcengine/Ark) via a single LLMClient.
  • Default Model Support: Defaults to google/gemini-3.5-flash if no model is specified during initialization, or set a default model for subsequent calls.
  • Environment-based Credentials: No need to hardcode API keys in the client — seamlessly picks up GEMINI_API_KEY, OPENAI_API_KEY, or VOLC_API_KEY / ARK_API_KEY.
  • Structured Pydantic Outputs: Validate and parse LLM outputs into Pydantic models with automatic retries on schema parse failures.
  • Tenacity Retry Logic: Automatic retry with exponential backoff and jitter for transient errors and schema validation failures.
  • Rate Limiting: Built-in rate limiting using aiolimiter.
  • Web Search: Grounding support with enable_search=True.

Installation

pip install gento

or with Poetry:

poetry add gento

Quick Start

Basic Text Generation

import asyncio
from gento import LLMClient

async def main():
    # Defaults to model="google/gemini-3.5-flash"
    client = LLMClient()

    # Generate response using default model
    response = await client.generate("Explain quantum computing in one sentence.")
    print("Content:", response.content)

    # Override model for specific call
    response_openai = await client.generate(
        "Explain special relativity in one sentence.",
        model="openai/gpt-4o"
    )
    print("OpenAI Content:", response_openai.content)

asyncio.run(main())

Structured Output with Pydantic

import asyncio
from pydantic import BaseModel, Field
from gento import LLMClient

class MovieInfo(BaseModel):
    title: str = Field(description="Title of the movie")
    release_year: int = Field(description="Release year")
    director: str = Field(description="Director of the movie")

async def main():
    client = LLMClient(model="google/gemini-3.5-flash")

    # Generate structured Pydantic model output
    movie: MovieInfo = await client.generate_structured(
        "Provide details about the movie Inception.",
        response_schema=MovieInfo,
    )

    print(f"Title: {movie.title}, Director: {movie.director}, Year: {movie.release_year}")

asyncio.run(main())

Web Search Grounding

import asyncio
from gento import LLMClient

async def main():
    client = LLMClient(model="google/gemini-3.5-flash")

    response = await client.generate(
        "What are the latest developments in AI technology this week?",
        enable_search=True,
    )
    print(response.content)

asyncio.run(main())

Supported Models & Provider Resolution

google/gemini-3.5-flash
google/gemini-3.6-flash
google/gemini-3.7-flash
openai/gpt-4o
openai/gpt-4o-mini
openai/gpt-5
openai/gpt-4o-mini
openai/gpt-4o
volcengine/doubao-1.5-pro-32k
volcengine/doubao-pro-32k

Environment Variables

  • Gemini: GEMINI_API_KEY
  • OpenAI: OPENAI_API_KEY (Optional: OPENAI_BASE_URL)
  • Volcengine/Ark: VOLCENGINE_API_KEY (Optional: VOLC_BASE_URL)

License

MIT

Release files for gento 0.1.0

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

Source distribution (sdist)

Source distribution for gento 0.1.0
File Size Uploaded
gento-0.1.0.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gento 0.1.0
File Interpreter ABI Platform
gento-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.2 kB

Release files / gento-0.1.0.tar.gz

Download URL gento-0.1.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7afe7102a890db7a0eeba1afd7297f184ecc58ed4701dd14be59af1fb507d95d
BLAKE2b-256 checksum
How to use checksums
57a6327f121039f2e90289c74f8b28e3dd3ca6640c96bcbb6c88c2741cbbe2bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.8 Darwin/24.6.0

Release files / gento-0.1.0-py3-none-any.whl

Download URL gento-0.1.0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4841c5bdc571703a880e32422fb5da5ef50922502e674e1cfc66e7da17a95dec
BLAKE2b-256 checksum
How to use checksums
9597e1c7528a59a4311ac12797baab5a323ecf3d599ce9bb4544f29f24d8bc5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.8 Darwin/24.6.0

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

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