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.2.0.tar.gz (6.2 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.2.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for maxmodel-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c8a33e615b9a56cf1b53e13456f885387a631d4ff7d23f24fa4480b6a2f2fa6e
MD5 94082326a1a98cda53a36e810d460271
BLAKE2b-256 6d9413d212f5e06bf1dc25e2fef8e183cccb15831f4dd68692ab618610429c30

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maxmodel-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b02c69ee94d80cb592d3aee7bdbe90e5216d4291160793792110cba07709fcce
MD5 fc9f5890a161dd86c0cccb1d7031aaa1
BLAKE2b-256 02cb5885f3e0f6e041f0b8f71f3b3003cb04bc000dbd0cbc850c3432bc4201f8

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