Developer Guides

How to Call the Quan 3.5 API

Model id, pricing, what changes from Quan 3.4, request examples in curl, JavaScript and Python, streaming, billing headers and errors.

Quan 3.5 model icon

Quan 3.5 is available on the StockUp Developer API. It uses the same endpoint, authentication, request body and response shape as Quan 3.4, and changes how answers are grounded, checked and returned. Quan 3.4 and Quan 3.4 L remain available.

quan-3.5 quan-3-5 POST /v1/query
Summary

Quick Start

Quan 3.5 uses the same endpoint as every Quan model: https://stockup.cc/v1/query. Create a key in the StockUp Developer Console, add a prepaid balance, pass the key in the x-api-key header, and send OpenAI-style chat messages in JSON. Only the model field changes from a Quan 3.4 request.

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

The response has the same shape as Quan 3.4: read the answer from candidates[0].content.parts[0].text. The X-Quan-Model-Version response header is 3.5 when Quan 3.5 served the request.

Pricing

Model ID Input per 1M tokens Output per 1M tokens Notes
quan-3.5 $5.50 $28.00 From November 1, 2026. Prepaid balance required; no free allowance.
quan-3.4 $2.50 until December 14, 2026; $3.00 from December 15, 2026 $15.00 until December 14, 2026; $18.00 from December 15, 2026 Behaviour unchanged by this release.
quan-3.4-l $0.75 $4.50 Unchanged. 100,000 free tokens for verified developers.

Billing: output tokens include the thinking tokens the model provider reports, as with every Quan model. Executed web searches cost $0.007 each. Each request is checked against your balance before the model runs, so a request your balance cannot fund returns 402 and is not generated.

Rates only, for comparison: a request that uses 2,000 input tokens and 6,000 output tokens costs $0.179 on quan-3.5, $0.095 on quan-3.4 ($0.114 from December 15) and $0.0285 on quan-3.4-l before any free allowance. The same question does not use the same number of tokens on every model, so measure your own traffic before comparing costs.

Which Model Should You Call?

Model ID Use It When
quan-3.5 You want the behaviour described in the next section: context carried across conversation turns, the latest reported results attached from SEC filings, multi-part questions answered section by section, answer styles, and checked short answers to everyday questions. It has the highest per-token price of the three.
quan-3.4 You have an integration built on Quan 3.4’s current behaviour, including streaming by default. Its behaviour is not changing with this release; its price changes on December 15, 2026.
quan-3.4-l Cost matters most. It runs at a fixed low reasoning level, has the lowest price of the three, and includes a free allowance.

What Changes From Quan 3.4

Quan 3.5 keeps Quan 3.4’s request and response format. The differences below are the ones an integration can observe.

Integration differences

Reasoning depth by question type

Everyday questions — a price, key figures, news, earnings, dividends, analyst views, what a company does, comparisons, funds, upcoming events, the economy and the Fed, the market, a sector, or explaining a concept — and “why is this stock moving” questions are answered at a lower reasoning level in a short format. Before the answer is returned, it is checked against the data the server retrieved for the request, and it is rewritten if it fails the check. Opinion, forecast, portfolio and multi-part questions keep the full reasoning path. The X-Quan-Thinking-Level header reports the level used.

Grounding and context

Calculations and unknowns

With Decision Intelligence enabled for the key:

A balance the user describes as unknown is never treated as cash. A request to treat it as cash is refused before any search or model call, with an X-Quan-Truth-Guard header and a quanTruthGuard object in the response. When cash is unknown, a sale counts in full against a one-day turnover limit.

Answer styles

Quan 3.5 accepts an optional answerStyle field. balanced (the default) and simple lead with the overall view in everyday words and explain finance terms; simple uses shorter sentences. advanced keeps the institutional write-up. Figures and checks are the same in every style. The X-Quan-Answer-Style header reports the style used.

{
  "model": "quan-3.5",
  "messages": [
    { "role": "user", "content": "Is my portfolio of 40% NVDA, 30% MSFT, 30% TLT too concentrated?" }
  ],
  "stream": false,
  "answerStyle": "simple"
}

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.5",
    messages: [
      {
        role: "user",
        content: "Summarize the most recent reported quarter for Microsoft."
      }
    ],
    stream: false,
    webSearch: true,
    temperature: 0.2
  })
});

if (!response.ok) {
  const error = await response.json().catch(() => null);
  throw new Error(`${response.status} ${error?.code || ""} ${error?.error || ""}`);
}

const data = await response.json();
const answer = data?.candidates?.[0]?.content?.parts?.[0]?.text;
console.log(answer);
console.log("charge (USD):", response.headers.get("X-StockUp-Charge"));

Python Example

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

import os
import requests

payload = {
    "model": "quan-3.5",
    "messages": [
        {
            "role": "user",
            "content": "Explain the difference between P/E and forward P/E."
        }
    ],
    "stream": False,
    "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"])
print("charge (USD):", res.headers.get("X-StockUp-Charge"))

Streaming Responses

Set stream to true for a chat UI or agent that should show partial output. The API returns server-sent events in the same format as other models: data: lines carrying JSON chunks, then data: [DONE].

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.5",
    "messages": [
      {
        "role": "user",
        "content": "Build a concise bullish and bearish thesis for AMZN using current market context."
      }
    ],
    "stream": true,
    "webSearch": true
  }'

The end of a stream looks like this (values are illustrative):

event: billing
data: {"requestId":"...","billingMode":"cash","charge":0.179,"searchCharge":0,"searchQueries":0,"remainingBalance":24.821,...}

data: [DONE]

Response and Billing Headers

Header Meaning
X-Quan-Model-Version 3.5 when the request was served by Quan 3.5.
X-StockUp-Model The model id as sent, lowercased: quan-3.5 or quan-3-5.
X-Quan-Thinking-Level The reasoning level used: HIGH, MEDIUM or LOW.
X-StockUp-Charge Total charged for the request in USD, tokens plus searches, to six decimal places.
X-StockUp-Search-Charge, X-StockUp-Search-Queries The search part of the charge and the number of executed searches charged.
X-StockUp-Balance Prepaid balance in USD after this request.
X-StockUp-Billing-Mode The billing path used for the request.
X-Quan-Answer-Style The answer style used: balanced, simple or advanced.
X-Quan-Cache hit when the answer came from Quan’s response cache, otherwise miss.
X-Request-Id Quote this when you contact support about a request.

Errors

Response Cause Fix
400 INVALID_PARAMETER temperature, topP or topK is not a number or is outside its range. Send a value inside the range, or omit the parameter.
400 INSUFFICIENT_OUTPUT_BUDGET The request needs the model to do a calculation itself and maxOutputTokens is too small. Not billed. Resend with maxOutputTokens at or above requiredMaxOutputTokens.
400 Unknown model... Typo in the model field. Use exactly quan-3.5 or quan-3-5.
402 PREPAID_BALANCE_REQUIRED The account has no prepaid balance. Quan 3.5 has no free allowance. Add a prepaid balance in the Developer Console.
402 INSUFFICIENT_RESPONSE_BUDGET The balance cannot cover maxOutputTokens at Quan 3.5 rates, with the safety margin reserved for reasoning tokens. The message says how many tokens the balance covers. Lower maxOutputTokens, or add balance.
402 INSUFFICIENT_BALANCE The balance cannot fund the request input at Quan 3.5 rates. Add balance.

A verified response-cache hit returns the stored answer without reserving or charging tokens or searches.

Launch Credit

The first 100 developers to redeem code QUAN35 in the developer console receive $5.00 of API credit that can be used only on quan-3.5.

Moving an Integration From Quan 3.4

  1. Change model to quan-3.5.
  2. Send stream explicitly. If your code reads server-sent events, send "stream": true.
  3. Check that temperature, topP and topK are inside their ranges, and handle 400 INVALID_PARAMETER.
  4. If you read billing on streams, read the event: billing frame.
  5. Confirm the switch with the X-Quan-Model-Version header.
  6. Compare X-StockUp-Charge on your own traffic before moving all of it.

OpenAPI and MCP for AI Agents

The public OpenAPI YAML and OpenAPI JSON list quan-3.5 in the model enum. In the StockUp MCP server, pass "model": "quan-3.5" as a tool argument; the server sends stream: false, so its requests work unchanged.

Production Checklist

  1. Store STOCKUP_API_KEY in server-side environment variables or a secret manager.
  2. Fund a prepaid balance before switching production traffic; Quan 3.5 has no free allowance.
  3. Set maxOutputTokens to the smallest budget your answers need, so the balance check and your costs stay predictable.
  4. Log X-Request-Id, X-Quan-Model-Version and X-StockUp-Charge (or the stream’s event: billing) for each request.
  5. Treat any response whose Content-Type is not application/json as a server error and retry it with backoff.

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