Skip to main content

maxmodel (Python)

The AI gateway with verified output. One API for every model, with a verified mode that returns answers grounded in your sources: verbatim citations, hallucinations stripped, checked by deterministic code (not an LLM judge).

pip install maxmodel
from maxmodel import MaxModel

mx = MaxModel(api_key="sk-...")  # your maxmodel.com gateway key

out = mx.verified.create(
    model="gpt-5.5-pro",
    messages=[{"role": "user", "content": "What is our refund policy?"}],
    sources=[{"id": "refunds.md", "text": "Full refunds within 30 days. No refunds after 30 days."}],
)

print(out.text)                 # grounded answer with inline [refunds.md] markers
for c in out.citations:
    print(f'✓ "{c.quote}" — {c.source} {c.range}')   # verbatim, traced to your source
for u in out.unsupported:
    print(f'⚠ dropped ({u.reason}): "{u.claim}"')     # hallucinations caught, not shipped

Why it's different

The grounding check is deterministic code: every cited quote must appear character-for-character in a source you supplied, or the claim is dropped. No "LLM judging an LLM".

API

MaxModel(api_key, *, base_url=..., timeout=60.0)

  • base_url defaults to https://api.maxmodel.com; override for self-host/testing.

mx.verified.create(...) -> VerifiedResult

arg type default
model str —
messages list[dict] —
sources list[dict] ({"id","text"}) —
mode "strict" | "lenient" "strict"
allow_ungrounded bool False
temperature float | None None
max_tokens int | None None

VerifiedResult (dataclass): id, model, text, citations, unsupported, grounded, usage.

mx.chat.completions.create(**params) -> dict

OpenAI-compatible passthrough.

Errors

Typed and catchable: MaxModelError (base) with AuthError (401), QuotaError (402), RateLimitError (429), NoSourcesError (400), ExtractionError (502), GatewayError (5xx). Each carries .type and .status.

from maxmodel import RateLimitError, NoSourcesError, MaxModelError

try:
    out = mx.verified.create(...)
except NoSourcesError:
    ...   # you forgot sources, or set allow_ungrounded=True
except RateLimitError:
    ...   # back off and retry
except MaxModelError as e:
    print(e.type, e.status)

Zero runtime dependencies (stdlib only). Python 3.8+. Docs: https://docs.maxmodel.com

Metadata

Release files for maxmodel 0.4.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 maxmodel 0.4.0
File Size Uploaded Provenance
maxmodel-0.4.0.tar.gz 6.6 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 15.2 kB

Release files / maxmodel-0.4.0.tar.gz

Download URL maxmodel-0.4.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b8871d6fd81e27c78f196ccf2459bdcc4e69fda53ee94c2b729450c5a5e12ffb
BLAKE2b-256 checksum
How to use checksums
3e58d40b9ac1892328f98d05fe736209b45d1607ae588f7a59349b6eeac3680f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / maxmodel-0.4.0-py3-none-any.whl

Download URL maxmodel-0.4.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
097c1bb6b7ad522f522ae81613a66523b65afbe492dd6dce4a0866aec85cbffa
BLAKE2b-256 checksum
How to use checksums
c199ef32d5f61ea86ace4b79cbdf9afac744e5e5d0c01edd7e03fd4590575182
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for maxmodel 0.4.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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