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.3.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.3.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: maxmodel-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 3b7f673eef0443b8144bc78cbf25f0367035a4db8b26c972e87aff7cb5082887
MD5 d4115f4857c0ca5e437c6ebd65ba318a
BLAKE2b-256 8084b4486613f1b70663ebfe6824c9f196d856824384d32c028e9c3ee5d6f118

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maxmodel-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f60ebd0e6a603b4c3fd520c4205f9f5a7ac30670b54b6cc5763d12061a2e1da1
MD5 232df0ed37cb4dc0faf947efcd4685b7
BLAKE2b-256 f95cbc786ff1b33a98a7d938c07ea27dbfc0643d801a3a9fac0381718212f37b

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