Skip to main content

The AI gateway with verified output. One API for every model, with verbatim citations and hallucinations stripped.

Project description

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

Project details


Download files

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

Source Distribution

maxmodel-0.4.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

maxmodel-0.4.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file maxmodel-0.4.0.tar.gz.

File metadata

  • Download URL: maxmodel-0.4.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for maxmodel-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b8871d6fd81e27c78f196ccf2459bdcc4e69fda53ee94c2b729450c5a5e12ffb
MD5 692abb22b9223530c579e1c128e20526
BLAKE2b-256 3e58d40b9ac1892328f98d05fe736209b45d1607ae588f7a59349b6eeac3680f

See more details on using hashes here.

File details

Details for the file maxmodel-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: maxmodel-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for maxmodel-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 097c1bb6b7ad522f522ae81613a66523b65afbe492dd6dce4a0866aec85cbffa
MD5 c5d31d136d73ab05551813d1c6a162b3
BLAKE2b-256 c199ef32d5f61ea86ace4b79cbdf9afac744e5e5d0c01edd7e03fd4590575182

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page