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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pollux_ai-2.0.0.tar.gz (809.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pollux_ai-2.0.0-py3-none-any.whl (126.8 kB view details)

Uploaded Python 3

File details

Details for the file pollux_ai-2.0.0.tar.gz.

File metadata

  • Download URL: pollux_ai-2.0.0.tar.gz
  • Upload date:
  • Size: 809.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pollux_ai-2.0.0.tar.gz
Algorithm Hash digest
SHA256 f37d16fa9d8d3d9e9c8cfde2fa472b4e28ffd028d0c78939609303cffd0462b9
MD5 6f5b945cf9b209255b15bbf09491ff1b
BLAKE2b-256 97ea0fd85a2fe12b0d81bc1d570f566e73baa50f9a4ded7d03b3076906ffab10

See more details on using hashes here.

Provenance

The following attestation bundles were made for pollux_ai-2.0.0.tar.gz:

Publisher: release.yml on seanbrar/pollux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pollux_ai-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pollux_ai-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 126.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pollux_ai-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bffc11046e46179c803b332d8786f65476b56687cff2c1dd9d1706a689eea89c
MD5 f9e456abddb246037a42855d01842587
BLAKE2b-256 1d67f6ef4a8f55822222af7cafeb0c76cc81323c4e9c1d4b28fefb6ba943958b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pollux_ai-2.0.0-py3-none-any.whl:

Publisher: release.yml on seanbrar/pollux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 files

1.8.0

2 files

1.7.0

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

1.3.0

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 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