Skip to main content

Pollux

Pollux sends prompts and multimodal sources to several LLM providers through one small Python interface. It handles uploads, shared context, retries, provider differences, and normalized results.

Install

pip install --upgrade pollux-ai

Set the key for the provider you want to use:

export GEMINI_API_KEY="your-key-here"     # or
export OPENAI_API_KEY="your-key-here"     # or
export ANTHROPIC_API_KEY="your-key-here"  # or
export OPENROUTER_API_KEY="your-key-here"

The local provider does not need a key. Point it at an OpenAI-compatible server with base_url or POLLUX_LOCAL_BASE_URL.

Ask About a File

import asyncio

from pollux import Config, Source, run

result = asyncio.run(
    run(
        "What are the key findings?",
        source=Source.from_file("paper.pdf"),
        config=Config(provider="gemini", model="gemini-2.5-flash-lite"),
    )
)

print(result.text)

run() returns an Output. Alongside text, it can contain structured data, tool calls, reasoning, token usage, completion details, and continuation state.

Changing providers is a configuration change:

Config(provider="openai", model="gpt-5-nano")
Config(provider="anthropic", model="claude-haiku-4-5")
Config(provider="openrouter", model="google/gemma-3-27b-it:free")
Config(provider="local", model="gemma3:4b", base_url="http://localhost:11434/v1")

Ask Several Questions About Shared Context

import asyncio

from pollux import Config, Source, run_many

results = asyncio.run(
    run_many(
        [
            "Summarize the methodology.",
            "List the key findings.",
            "Identify the main limitation.",
        ],
        sources=[Source.from_file("paper.pdf")],
        config=Config(provider="gemini", model="gemini-2.5-flash-lite"),
    )
)

for answer in results.answers:
    print(answer)

Every prompt sees the same source set. Pollux reuses uploaded content and runs the prompts concurrently. To process separate files independently, write the outer loop in your application and call run() or run_many() for each file.

Choose the Smallest Entry Point

Need Use
One answer now run()
Several prompts over shared sources run_many()
Conversation history or tool calls interact() or Session
Incremental output stream()
Provider-side asynchronous work defer()

The advanced entry points use the same Environment, Input, Output, and OutputCollection types as the simple path.

Documentation

Development

uv sync
just check

See Contributing for the repository layout and focused development commands.

License

MIT

Metadata

Release files for pollux-ai 2.0.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 pollux-ai 2.0.0
File Size Uploaded
pollux_ai-2.0.0.tar.gz 809.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pollux-ai 2.0.0
File Interpreter ABI Platform
pollux_ai-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 936.0 kB

Release files / pollux_ai-2.0.0.tar.gz

Download URL pollux_ai-2.0.0.tar.gz
Size 809.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f37d16fa9d8d3d9e9c8cfde2fa472b4e28ffd028d0c78939609303cffd0462b9
BLAKE2b-256 checksum
How to use checksums
97ea0fd85a2fe12b0d81bc1d570f566e73baa50f9a4ded7d03b3076906ffab10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 30, 2026.

Transparency log

Release files / pollux_ai-2.0.0-py3-none-any.whl

Download URL pollux_ai-2.0.0-py3-none-any.whl
Size 126.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bffc11046e46179c803b332d8786f65476b56687cff2c1dd9d1706a689eea89c
BLAKE2b-256 checksum
How to use checksums
1d67f6ef4a8f55822222af7cafeb0c76cc81323c4e9c1d4b28fefb6ba943958b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 30, 2026.

Transparency log
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