MarketIntell

Chat API

Core endpoint for the MarketIntell AI analyst desk — stocks, options, and crypto

Chat API

The Chat API is the core endpoint of MarketIntell. Send any market question — stocks, options, or crypto — and receive a multi-specialist, correlated analysis routed through 26 specialists across 27+ external services. The API auto-detects the domain from your query (e.g., "AAPL trade setup" routes to US equities, "BTC analysis" routes to crypto), or you can force a domain explicitly.

POST /v1/chat

Send a message to the MarketIntell reasoning pipeline.

Request Headers

HeaderRequiredDescription
Content-TypeYesMust be application/json
X-API-KeyYesYour API key

Request Body

FieldTypeRequiredDescription
messagestringYesYour market question (stocks, options, or crypto)
session_idstring (UUID)NoContinue a previous conversation session
streambooleanNoEnable Server-Sent Events streaming (default: false)
domainstringNoForce domain: crypto or us_equities (covers stocks + options). Auto-detected from query if omitted.
modestringNo"deep" forces the T3 supervisor pipeline (Pro+ only). Use for high-complexity queries that benefit from multi-specialist debate.
portfolio_idstringNoInject a specific portfolio's context into the prompt. Must be owned by the calling key — cross-owner ids are silently ignored.
include_portfoliobooleanNoWhen true (and no portfolio_id supplied), automatically inject the calling key's most-recently-updated portfolio.
response_formatobjectNo{ type: "json_schema", schema: {...} } for structured output. Built-in schemas: trade_setup, market_analysis, token_screen.

Example Request — Crypto

curl -X POST https://api.marketintell.ai/v1/chat \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "message": "What is the risk/reward for a long ETH position here?",
    "stream": false
  }'

Example Request — US Equities

curl -X POST https://api.marketintell.ai/v1/chat \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "message": "NVDA trade setup — long or short with options flow?",
    "stream": false
  }'

Example Request — Explicit Domain

curl -X POST https://api.marketintell.ai/v1/chat \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "message": "Compare AAPL vs MSFT earnings growth",
    "domain": "us_equities",
    "stream": false
  }'

Non-Streaming Response

When stream is false (default), the API returns a single JSON response after the full pipeline completes.

Response Body

FieldTypeDescription
successbooleanWhether the request succeeded
data.session_idstringSession ID for follow-up messages
data.domainstringDetected or forced domain: crypto or us_equities
data.contentstringThe full analysis in Markdown format
data.specialists_usedstring[]Which specialists contributed
data.classificationobjectHow the query was classified
data.correlationobjectCross-specialist correlation results
data.latency_msnumberTotal processing time in milliseconds
data.timestampstringISO 8601 timestamp

Example Response — Crypto

{
  "success": true,
  "data": {
    "session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "domain": "crypto",
    "content": "## ETH Long Position Risk/Reward Analysis\n\n**Entry:** $3,245\n**Target:** $3,800 (+17.1%)\n**Stop Loss:** $3,050 (-6.0%)\n**Risk/Reward Ratio:** 2.85:1\n\n### Technical Analysis\nETH is holding above the 200-day MA with rising volume...",
    "specialists_used": ["technical", "fundamental", "quantitative"],
    "classification": {
      "specialists": ["technical", "fundamental", "quantitative"],
      "tokens": ["ETH"],
      "timeframe": "medium",
      "intent": "trade_setup"
    },
    "correlation": {
      "alignment": "bullish",
      "score": 6.5,
      "confirming": [
        "Price above key moving averages",
        "Rising TVL and protocol revenue",
        "Positive risk-adjusted momentum"
      ],
      "contradicting": [
        "Declining gas usage trend"
      ],
      "sizing_multiplier": 1.2,
      "summary": "Moderate bullish alignment across technical and fundamental signals with minor on-chain usage concern."
    },
    "latency_ms": 4210,
    "timestamp": "2025-01-15T14:22:00.000Z"
  }
}

Example Response — US Equities

{
  "success": true,
  "data": {
    "session_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "domain": "us_equities",
    "content": "## NVDA Trade Setup\n\n**Bias:** Long\n**Entry:** $135.20\n**Target:** $152.00 (+12.4%)\n**Stop Loss:** $128.50 (-4.9%)\n**Risk/Reward Ratio:** 2.51:1\n\n### Technical Analysis\nNVDA is consolidating above the 50-day MA with a bullish MACD crossover...\n\n### Fundamental Context\nRevenue grew 122% YoY with data center segment driving 87% of total revenue. Forward P/E of 35x vs sector median 28x...\n\n### Options Flow\nUnusual call activity at $150 strike for next month expiry, 3.2x average volume...",
    "specialists_used": ["technical", "fundamental", "quantitative"],
    "classification": {
      "specialists": ["technical", "fundamental", "quantitative"],
      "tickers": ["NVDA"],
      "timeframe": "medium",
      "intent": "trade_setup"
    },
    "correlation": {
      "alignment": "bullish",
      "score": 7.1,
      "confirming": [
        "Price above key moving averages with rising volume",
        "Strong revenue growth and margin expansion",
        "Bullish options flow with heavy call buying"
      ],
      "contradicting": [
        "Elevated valuation vs historical range"
      ],
      "sizing_multiplier": 1.3,
      "summary": "Strong bullish alignment across technicals, fundamentals, and options flow. Valuation stretch is the primary risk factor."
    },
    "latency_ms": 5340,
    "timestamp": "2025-07-15T14:22:00.000Z"
  }
}

Classification Object

Every response includes a classification that describes how the query was routed through the pipeline.

FieldTypeDescription
specialistsstring[]Specialists activated for this query
tokensstring[]Crypto tokens identified (crypto domain)
tickersstring[]Stock tickers identified (equities domain)
timeframestringDetected timeframe: short, medium, or long
intentstringOne of 16 classified intents (see Intents)

Note: The classification object includes tokens for crypto queries and tickers for equities queries. Both may be present if the query spans domains.


Correlation Object

The correlation object describes how signals from multiple specialists align or conflict.

FieldTypeDescription
alignmentstringOverall direction: bullish, bearish, neutral, or mixed
scorenumberAlignment score from -10 (max bearish) to +10 (max bullish)
confirmingstring[]Signals that agree across specialists
contradictingstring[]Signals that conflict across specialists
sizing_multipliernumberPosition sizing suggestion: 0.5 (low conviction) to 2.0 (high conviction)
summarystringHuman-readable correlation summary

A high sizing_multiplier (above 1.5) indicates strong cross-specialist agreement. Values below 0.8 suggest conflicting signals — proceed with caution.


Streaming Response

When stream is true, the API returns a stream of Server-Sent Events (SSE).

# Crypto streaming example
curl -N -X POST https://api.marketintell.ai/v1/chat \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "message": "BTC whale activity analysis",
    "stream": true
  }'

# Equities streaming example
curl -N -X POST https://api.marketintell.ai/v1/chat \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "message": "AAPL earnings preview — what to expect?",
    "stream": true
  }'

SSE Event Types

The exact set of events depends on which path the brain takes (fast agent vs. CoT pipeline vs. T3 supervisor). All paths terminate with a single done frame.

EventPathDescription
tool_call_startedT1 fast agentThe agent has begun processing
tool_call_completedT1 fast agentAgent processing finished, prose about to begin
planAllInitial intent classification (intent + specialists)
metaT2 CoTEarly metadata (direction, confidence, convergence, fact/tension counts) emitted as soon as Steps 1–4 complete, before the prose stream begins
specialist_startedT3 supervisorA specialist agent began work
specialist_completedT3 supervisorA specialist agent returned a verdict
synthesis_startedT3 supervisorThe supervisor began synthesizing specialist outputs
text_deltaAllA chunk of the response content
doneAllStream complete — includes session_id, specialists_used, latency_ms, and (for CoT) top-level direction / confidence / citedFacts
errorAllAn error occurred during processing

Event Format

Each SSE event uses a named event: field and a JSON data: payload with an incrementing id::

event: tool_call_started
data: {"tool":"agent"}
id: 0

event: tool_call_completed
data: {"tool":"agent","latencyMs":2150}
id: 1

event: text_delta
data: {"delta":"## BTC Whale Activity\n\nLarge wallets have accumulated **12,400 BTC** in the past 48 hours..."}
id: 2

event: done
data: {"session_id":"a1b2c3d4-...","specialists_used":["technical","onchain"],"latency_ms":5120,"timestamp":"2025-01-15T14:22:00.000Z","direction":"bullish","confidence":0.74,"citedFacts":18}
id: 3

For CoT-routed queries, the done payload includes top-level direction ("bullish" / "bearish" / "neutral"), confidence (0–1), and citedFacts. The legacy fast-agent path nests these under a correlation object instead — accept both shapes when integrating.

JavaScript Streaming Example

const response = await fetch("https://api.marketintell.ai/v1/chat", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-API-Key": "YOUR_API_KEY",
  },
  body: JSON.stringify({
    message: "BTC whale activity analysis",
    stream: true,
  }),
});

const reader = response.body!.getReader();
const decoder = new TextDecoder();
let buffer = "";
let currentEvent = "";

while (true) {
  const { done, value } = await reader.read();
  if (done) break;

  buffer += decoder.decode(value, { stream: true });
  const lines = buffer.split("\n");
  buffer = lines.pop() || "";

  for (const line of lines) {
    if (line.startsWith("event: ")) {
      currentEvent = line.slice(7);
    } else if (line.startsWith("data: ")) {
      const data = JSON.parse(line.slice(6));

      switch (currentEvent) {
        case "tool_call_started":
          console.log(`[Started] ${data.tool}`);
          break;
        case "tool_call_completed":
          console.log(`[Completed] ${data.tool} in ${data.latencyMs}ms`);
          break;
        case "text_delta":
          process.stdout.write(data.delta);
          break;
        case "done":
          console.log("\n\nSpecialists:", data.specialists_used);
          console.log("Latency:", data.latency_ms, "ms");
          break;
        case "error":
          console.error("Error:", data.error);
          break;
      }
    }
  }
}

Sessions

Pass a session_id to continue a conversation:

curl -X POST https://api.marketintell.ai/v1/chat \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "message": "What about the short-term outlook?",
    "session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }'

The pipeline retains context from previous messages in the session, enabling follow-up questions and multi-turn analysis.

On this page