Developer Guides

How to Call Quan 3.4, Quan 3.4 L, and Deep Research APIs

A practical StockUp guide for building stock research apps, custom GPT actions, Claude MCP workflows, Cursor agents, portfolio tools, and financial AI copilots with the new Quan 3.4 models.

Quan 3.4 model icon

Quan 3.4 is StockUp's flagship financial reasoning API for quote-grounded stock analysis, valuation comparison, catalyst review, market-move explanations, and agent-ready financial research. Quan 3.4 L is the lower-cost runtime for faster market analysis with the same Quan 3.4 reasoning contract. Quan 3.4 Deep Research extends the API surface for longer SEC filing audits, portfolio reviews, and multi-step research workflows.

quan-3.4 quan-3.4-l quan-3.4-deep-research POST /v1/query

Quick Start

All Quan API calls use the same endpoint: https://stockup.cc/v1/query. Create a key in the StockUp Developer Console, pass it through the x-api-key header, and send OpenAI-style chat messages in JSON. New verified developers receive 100,000 free Quan 3.4 L tokens without a card or prepaid balance. Quan 3.0 keeps a separate 100,000-token allowance.

Cost control: Free Quan 3.4 L requests include up to two executed searches. Additional Tavily searches are passed through at $0.015 each. Quan 3.4 L overage costs $0.75/M input and $4.50/M output tokens; Quan 3.4 costs $2.50/M input and $15/M billable output tokens; Deep Research costs $4/M input and $24/M billable output, including internal stages.

Response limits: Each API key has a configurable defaultMaxOutputTokens and maxOutputTokensCap. Both default to 65,536, the current provider maximum. Pass maxOutputTokens per request to choose a lower budget. Requests above the key cap or provider maximum return 400; requests that cannot be funded return 402 before generation instead of being silently shortened. Thinking tokens count toward usage and billing.

curl -X POST https://stockup.cc/v1/query \
  -H "Content-Type: application/json" \
  -H "x-api-key: STOCKUP_API_KEY" \
  -d '{
    "model": "quan-3.4",
    "messages": [
      {
        "role": "user",
        "content": "Compare AAPL and MSFT valuation today. Separate confirmed data from interpretation."
      }
    ],
    "stream": false,
    "webSearch": true,
    "maxOutputTokens": 65536,
    "temperature": 0.2
  }'

Which Model Should You Call?

Model ID Best For Example Agent Workflow
quan-3.4-l Lower-cost, faster Quan 3.4 market recaps, quote-grounded research, and high-volume product workflows. Market-monitoring app, investor dashboard, finance chat workflow, source-grounded market recap.
quan-3.4 Fast flagship stock analysis, valuation comparisons, catalyst summaries, real-time quote grounding, market sentiment, and investor-ready explanations. AI stock screener, investing chatbot, market move explainer, financial API backend, custom GPT Action.
quan-3.4-deep-research Longer research tasks that need deeper reasoning across filings, portfolios, competitive positioning, risk factors, management guidance, and multi-step investment memos. SEC filing AI reader, portfolio risk review agent, due diligence assistant, Claude financial MCP workflow, Cursor research agent.

Rule of thumb: use quan-3.4-l when speed and cost matter while retaining Quan 3.4 behavior. Use quan-3.4 for flagship analysis and quan-3.4-deep-research when the output should behave more like an analyst memo than a quick answer.

Calling Quan 3.4 L

Quan 3.4 L includes 100,000 account-level tokens for verified developers. It supports the same request shape, streaming, verified StockUp context, and opt-in live grounding as Quan 3.4. A prepaid wallet is needed only for token overage, searches after the two included per grounded free request, or continued use after the allowance.

curl -X POST https://stockup.cc/v1/query \
  -H "Content-Type: application/json" \
  -H "x-api-key: STOCKUP_API_KEY" \
  -d '{
    "model": "quan-3.4-l",
    "messages": [
      { "role": "user", "content": "Summarize today\'s U.S. market move. Separate verified facts from inference." }
    ],
    "stream": false,
    "webSearch": true
  }'

Light Market Insights

For easy ticker questions like How is AAPL performing today?, Quan 3.0 and Quan 3.4 now use a Light Market Intent layer. The default response is still plain text, but Quan can add a concise source-grounded read: price, session move, move character, and a useful next thing to watch.

If your app wants renderable chips or cards, set includeInsightMetadata: true. For stream: false, the API may include a top-level quanLightMarketInsight object. For stream: true, the API may emit an event: quan_light_market_insight SSE event before completion. The metadata is omitted when Quan cannot ground it to real source-linked quote context.

{
  "model": "quan-3.4",
  "messages": [
    { "role": "user", "content": "How is AAPL performing today?" }
  ],
  "stream": false,
  "includeInsightMetadata": true
}

JavaScript Example

This is the basic pattern for a Node.js backend, serverless function, or agent tool wrapper. Keep the API key on the server side rather than shipping it to a browser client.

const response = await fetch("https://stockup.cc/v1/query", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": process.env.STOCKUP_API_KEY
  },
  body: JSON.stringify({
    model: "quan-3.4",
    messages: [
      {
        role: "user",
        content: "Why is NVDA moving today? Give confirmed facts, possible drivers, risks, and what to watch next."
      }
    ],
    stream: false,
    webSearch: true,
    temperature: 0.2
  })
});

const data = await response.json();
const answer = data?.candidates?.[0]?.content?.parts?.[0]?.text;
console.log(answer);

Python Example

Python works well for research notebooks, batch portfolio checks, Slack bots, and internal analyst tools.

import os
import requests

payload = {
    "model": "quan-3.4-deep-research",
    "messages": [
        {
            "role": "user",
            "content": "Audit Tesla's latest risks, margin pressure, demand signals, and valuation setup. Cite uncertainty clearly."
        }
    ],
    "stream": False,
    "webSearch": True,
    "temperature": 0.2
}

res = requests.post(
    "https://stockup.cc/v1/query",
    headers={
        "Content-Type": "application/json",
        "x-api-key": os.environ["STOCKUP_API_KEY"]
    },
    json=payload,
    timeout=120
)

res.raise_for_status()
data = res.json()
print(data["candidates"][0]["content"]["parts"][0]["text"])

Streaming Responses

Set stream to true when you are building a chat UI, research workspace, or AI agent that should show partial output while Quan is reasoning. The API returns server-sent events.

curl -N -X POST https://stockup.cc/v1/query \
  -H "Content-Type: application/json" \
  -H "x-api-key: STOCKUP_API_KEY" \
  -d '{
    "model": "quan-3.4",
    "messages": [
      {
        "role": "user",
        "content": "Build a concise bullish and bearish thesis for AMZN using current market context."
      }
    ],
    "stream": true,
    "webSearch": true
  }'

Deep Research Prompt Pattern

For quan-3.4-deep-research, give the model a clear research job, ticker scope, output shape, and uncertainty standard. That helps AI agents produce repeatable financial research rather than loose commentary.

{
  "model": "quan-3.4-deep-research",
  "messages": [
    {
      "role": "user",
      "content": "Create a deep research memo on GOOGL. Cover business segments, valuation, margin trend, AI capex risk, regulatory risk, recent catalysts, bear case, bull case, and 5 questions an analyst should ask next. Separate facts from judgment."
    }
  ],
  "stream": false,
  "webSearch": true,
  "temperature": 0.15
}

OpenAPI and MCP for AI Agents

Quan 3.4 is designed to be discovered and called by AI agents. Use the public OpenAPI YAML or OpenAPI JSON for custom GPT Actions, internal workflow builders, and tool-calling agents. Use the StockUp MCP guide or the public MCP server script to connect Quan to Claude Desktop, Cursor, and other MCP-compatible clients.

Related Financial AI Resources

Choose the guide that matches the product you are building:

Production Checklist

  1. Store STOCKUP_API_KEY in server-side environment variables or a secret manager.
  2. Use quan-3.4 as the default model for most user-facing queries.
  3. Route long-form SEC, portfolio, or due-diligence tasks to quan-3.4-deep-research.
  4. Set stream: true for chat interfaces and stream: false for jobs that need one JSON payload.
  5. Ask prompts to separate confirmed facts, model judgment, and unknowns for cleaner financial outputs.
  6. Link agents to llms.txt, OpenAPI, and MCP so tools can discover StockUp reliably.

StockUp Quan responses are for research and education. They are not personalized financial advice, investment recommendations, or a substitute for professional due diligence.