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.1.0.tar.gz (5.7 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.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for maxmodel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3bc26a84dc3d4694615235b90faeee00c0a112d6ffb6988c94d55e1acb9bf50f
MD5 f34298e9718882dcf3e4727bdfa671c9
BLAKE2b-256 9c770b050b0f2984b9cb819aca8430d2af3c8257db0600d8d4f0b63bc41b438f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maxmodel-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f83321f6c57169836260b9df241a9b44c75c7df1315f618cd2afa1af7848b18
MD5 a41a367b026a9754fbfc5ebefdd08965
BLAKE2b-256 494cddf0a869898c46b998ffdee800f5a4d0d99b49eba9b533dea114678614d0

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