Quickstart

Quickstart

Make your first verified call in two minutes.

1. Install

npm i maxmodel

The SDK ships ESM + CJS and types, with zero required runtime dependencies (it uses the platform fetch). Node 18+ or any modern runtime.

2. Get an API key

Sign in at maxmodel.com and create an API key in the console (keys are called tokens there). It’s the same key you use to call the maxmodel.com gateway directly — verified output does not use a separate key system, and usage is metered on that key.

Set it in your environment:

export MAXMODEL_KEY=sk-...

Keep the key server-side. Like any gateway key it can spend against your account — don’t ship it in client-side code.

3. Make a verified call

import { MaxModel } from 'maxmodel'
 
const mx = new MaxModel({ apiKey: process.env.MAXMODEL_KEY! })
 
// Your knowledge: docs, a wiki page, retrieved RAG chunks — whatever you already have.
const sources = [
  { id: 'pricing.md', text: 'The Pro plan costs $29/month and includes 50 seats.' },
  { id: 'sla.md', text: 'Uptime SLA is 99.9%. Support responds within 24 hours.' },
]
 
const out = await mx.verified.create({
  model: 'gpt-5.5-pro',
  messages: [{ role: 'user', content: 'How much is Pro, and what is the support SLA?' }],
  sources,
})
 
console.log(out.text)
// "Pro is $29/month [pricing.md]; support responds within 24 hours [sla.md]."
 
for (const c of out.citations) {
  console.log(`✓ "${c.quote}" — ${c.source}`) // verbatim, traced to your source
}
for (const u of out.unsupported) {
  console.log(`⚠ dropped (${u.reason}): "${u.claim}"`) // hallucinations caught, not shipped
}

Timeout: reasoning models like gpt-5.5-pro can take 60–90s. The client default is 60s, so raise it when you use them: new MaxModel({ apiKey, timeout: 180_000 }). Or use a faster model (e.g. gpt-5).

4. Compare with a plain call

The same client is an OpenAI-compatible drop-in. A plain call may quietly invent numbers; the verified call cannot — every fact is tied to a quote from your sources.

const plain = await mx.chat.completions.create({
  model: 'gpt-5.5-pro',
  messages: [{ role: 'user', content: 'How much is Pro?' }],
})
console.log(plain.choices[0].message.content) // ungrounded

Next