MultiModelQuery

The core class of the free SDK. Query multiple AI models in parallel with typed responses — one instance, any number of queries.

Creating an instance

import { createMultiModelQuery } from 'decisionmemos';

// Reads API keys from process.env by default
const query = createMultiModelQuery();

// Or pass keys explicitly
const query = createMultiModelQuery({
  keys: {
    openai: 'sk-...',
    anthropic: 'sk-ant-...',
    xai: 'xai-...',
    google: 'AIza...',
  },
});

MultiModelOptions

interface MultiModelOptions {
  /** Override which model clients to use */
  clients?: AIModelClient[];

  /** Custom keys (alternative to env vars) */
  keys?: {
    openai?: string;
    anthropic?: string;
    xai?: string;
    google?: string;
  };
}

ask(question, systemPrompt?)

Send the same question to all configured models in parallel. Returns a MultiModelResult with typed responses from every model.

const result = await query.ask(
  "Should we open-source our internal tooling?",
  "You are a senior engineering advisor."
);

console.log(result.successCount + " models responded");
console.log("Total time: " + result.totalLatency + "ms");

for (const r of result.responses) {
  if (r.error) {
    console.log(r.modelName + " failed: " + r.error);
  } else {
    console.log(r.modelName + ": " + r.response.slice(0, 200));
  }
}

MultiModelResult

interface MultiModelResult {
  question: string;
  responses: ModelResponse[];
  successCount: number;
  errorCount: number;
  totalLatency: number; // wall-clock ms
  timestamp: Date;
}

testConnections()

Test connectivity to all configured providers. Useful for health checks.

const results = await query.testConnections();

for (const r of results) {
  console.log(r.model + " (" + r.provider + "): " + (r.ok ? "ok" : "failed"));
}

getStatus()

Get the number and names of configured models without making API calls.

const status = query.getStatus();
// { count: 4, models: [{ name: "GPT-5.2", provider: "openai" }, ...] }
Tip
MultiModelQuery returns raw model responses. For structured verdicts with consensus scoring, advisor personas, and Decision Memos, use the hosted API — which adds the proprietary orchestration layer.