AI-GENERATED · DISCLAIMER
Almanex
Docs / Agent · compare
◆ Agent

Compare tickers

Cross-company structured comparisons sourced from the Almanex corpus. Your model or ours.

The agent calls Almanex's HTTP API for each ticker, then assembles a narrative + a normalized comparison table — every claim cites a report URL.

POST /api/agent/compare

Bearer auth (your Almanex key). Optionally pass any of X-Anthropic-Key, X-Gemini-Key, X-OpenAI-Key, or X-Model-Endpoint+X-Model-Key to use your own model — billing skips Almanex managed inference (BYOK mode). Setting more than one cascades on transient errors.

◆ Body
{
  "tickers": ["NVDA", "AMD", "AVGO"],     // 2–8 symbols
  "dimension": "growth"                   // null | growth | margins | valuation | capital-return
                                          //   (null = synthesize across all)
  "depth": "summary"                      // summary | deep
}
◆ Response (200)
{
  "result": "markdown narrative…",
  "table": [{ "ticker":"NVDA", "company":"…", "rating":"Buy", … }],
  "sources": [{ "ticker":"NVDA", "title":"…", "url":"/reports/nvda/…", "excerpt":"…" }],
  "coverage_gaps": ["ZZZZ"],
  "_meta": { "billing_mode":"managed" | "byok",
             "inference_cost_cents": number | null,
             "tokens_used": number, "downstream_calls": number,
             "latency_ms": number,
             "model": "claude-sonnet-4-6",
             "provider": "anthropic" | "gemini" | "openai" | "openai-compat",
             "providers_tried": [{ "provider": "...", "model": "...",
                                   "status": "ok" | number | "network_error" | "timeout",
                                   "latency_ms": number, "error_detail"?: string }] }
}
◆ Try it

Live playground

Live request, your browser, your key. The Almanex key is read from sessionStorage['almanex.docs.api_key'] (shared across all docs pages). Optional provider keys live under the almanex.byok.* namespace and only ever leave your browser via the matching X-*-Key request header.

depth
Bring your own model (BYOK)

Drop in any provider key — Anthropic, Gemini, OpenAI, or any OpenAI-compatible endpoint (Together, Groq, OpenRouter, vLLM, Ollama). When you set more than one, the agent cascades through them on a 5xx/429/network error. Keys live only in this tab's sessionStorage and are forwarded as the corresponding X-*-Key request headers. They never reach our database, our logs, or any analytics.

Provider Key Status
Anthropic (sk-ant-…)
Gemini (AIza…)
OpenAI (sk-…)
Custom (OpenAI-compatible)
Together, Groq, OpenRouter, vLLM, Ollama
cascade order
Will use: Almanex managed
Anthropic ↗ Gemini ↗ OpenAI ↗

Almanex key: missing
◆ Result

Add 2–8 tickers and run a comparison. Results — narrative, normalized table, and source citations — will render here.

  • · Each table row links back to the source report.
  • · Tickers not in the corpus appear under coverage gaps.
  • · BYOK calls are clearly badged in the meta strip.
◆ Errors

Error responses

Errors come back as JSON with a stable error field your code can switch on.

  • 400 bad_request
    Tickers missing/empty, more than 8, or unknown dimension.
  • 401 unauthorized
    Missing or invalid Almanex API key.
  • 402 byok_provider_error
    Your BYOK provider key was rejected by the upstream — check the provider's console.
  • 429 rate_limited
    Monthly Almanex quota exhausted. Upgrade at /pricing.
  • 503 no_managed_provider_configured
    Operator hasn't set ANTHROPIC_API_KEY / GEMINI_API_KEY / OPENAI_API_KEY. Use BYOK to proceed.
  • 503 all_providers_failed
    Every provider in the cascade returned a transient error. The response includes a per-provider audit trail.