Skip to main content

inferall-ai

Official Python SDK for the InferAll AI gateway. One API, every model provider — OpenAI, Anthropic, Google Gemini, Replicate, and more — behind a single bearer token.

The PyPI distribution name is inferall-ai; the import name is inferall. (The shorter inferall distribution name is owned by an unrelated project on PyPI.)

Zero runtime dependencies. The client uses only the Python standard library so it ships cleanly into lambdas, edge functions, and air-gapped containers.

Install

pip install inferall-ai

Requires Python 3.10+.

Quick start

from inferall import Inferall

ai = Inferall()  # reads INFERALL_API_KEY from the environment

# The built-in default is Gemini, which is a PAID model. On the no-card trial
# pass a free NVIDIA model so this first call succeeds.
print(
    ai.text(
        "Summarize the theory of relativity in two sentences.",
        provider="nvidia",
        model="nvidia/nemotron-3-ultra-550b-a55b",
    )
)

Explicit credentials

ai = Inferall(api_key="ifu_...")

System prompt + custom model

ai.text(
    "Translate to French: 'Where is the library?'",
    system="You are a careful translator.",
    provider="openai",
    model="gpt-4o-mini",
    temperature=0.2,
)

Multi-turn chat

ai.chat(
    [
        {"role": "user", "content": "Hello!"},
        {"role": "assistant", "content": "Hi there — how can I help?"},
        {"role": "user", "content": "What's 2 + 2?"},
    ]
)

Vision

import base64

with open("receipt.jpg", "rb") as f:
    image_b64 = base64.b64encode(f.read()).decode()

ai.vision(image_b64, "What's the total on this receipt?")

Raw responses

When you need access to tool calls, fallback metadata, or any provider-specific field, use generate() to get the full payload:

raw = ai.generate(
    provider="anthropic",
    model="claude-sonnet-4-6",
    operation="chat",
    messages=[{"role": "user", "content": "..."}],
)

Environment variables

Variable Purpose
INFERALL_API_KEY Bearer token. Used when api_key= isn't passed to the constructor.
INFERALL_BASE_URL Override the gateway URL (default https://api.inferall.ai).
AI_GATEWAY_KEY Legacy fallback for INFERALL_API_KEY (recognised for back-compat).
AI_GATEWAY_URL Legacy fallback for INFERALL_BASE_URL.

Errors

Gateway failures raise InferallError, a subclass of RuntimeError:

from inferall import Inferall, InferallError

try:
    ai.text("...")
except InferallError as e:
    print(e.status, e.body)

License

MIT

Metadata

Release files for inferall-ai 0.1.1

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

Source distribution (sdist)

Source distribution for inferall-ai 0.1.1
File Size Uploaded
inferall_ai-0.1.1.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for inferall-ai 0.1.1
File Interpreter ABI Platform
inferall_ai-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / inferall_ai-0.1.1.tar.gz

Download URL inferall_ai-0.1.1.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ccd576944e5041371bcc8e75ba40d4548008fb3b98ebb5f4c7a34ba7cbc26d53
BLAKE2b-256 checksum
How to use checksums
10e11fae54f923a4609e7f779b9daa745c78d7d165e3a47ccc9875be3d951778
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 Oct 5, 2026.

Transparency log

Release files / inferall_ai-0.1.1-py3-none-any.whl

Download URL inferall_ai-0.1.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec2551aca8ca432540c403319d01d3d40d8c84b033bcc23b1feef61a7ef3b07c
BLAKE2b-256 checksum
How to use checksums
281036ce8704336eff0636e03f4841792154680ca441b08d86be615eb821b10b
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 Oct 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

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