> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gigabrain.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Brain API Overview

> Build trading bots with The Brain API

One endpoint. Stateless. Ask anything in plain English, get back trade-ready analysis. No sessions to manage, no state to track.

```
POST /v1/chat
```

<Note>
  Rate limit: **60 requests per minute**. Set your HTTP client timeout to at least 600 seconds. See [Auth & Basics](/developers/introduction) for full details.
</Note>

## Get a Trade Setup

Ask The Brain for a trade and get back entry, stop-loss, and targets you can feed straight into your execution logic.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    import requests, json

    response = requests.post(
        "https://api.gigabrain.gg/v1/chat",
        headers={"Authorization": "Bearer gb_sk_..."},
        json={
            "message": "Should I long or short ETH right now? Check technicals, funding rates, and macro. Respond as JSON with: direction, entry_price, stop_loss, take_profit_1, take_profit_2, risk_reward_ratio, confidence, reasoning"
        },
        timeout=600
    )

    setup = json.loads(response.json()["content"])
    print(f"{setup['direction']} ETH @ {setup['entry_price']}")
    print(f"Stop: {setup['stop_loss']} | TP1: {setup['take_profit_1']} | TP2: {setup['take_profit_2']}")
    print(f"R:R {setup['risk_reward_ratio']} | Confidence: {setup['confidence']}/10")
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const res = await fetch("https://api.gigabrain.gg/v1/chat", {
      method: "POST",
      headers: {
        Authorization: "Bearer gb_sk_...",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        message: "Should I long or short ETH right now? Check technicals, funding rates, and macro. Respond as JSON with: direction, entry_price, stop_loss, take_profit_1, take_profit_2, risk_reward_ratio, confidence, reasoning",
      }),
      signal: AbortSignal.timeout(600000),
    });

    const setup = JSON.parse((await res.json()).content);
    console.log(`${setup.direction} ETH @ ${setup.entry_price}`);
    console.log(`Stop: ${setup.stop_loss} | TP1: ${setup.take_profit_1} | TP2: ${setup.take_profit_2}`);
    console.log(`R:R ${setup.risk_reward_ratio} | Confidence: ${setup.confidence}/10`);
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST https://api.gigabrain.gg/v1/chat \
      -H "Authorization: Bearer gb_sk_..." \
      -H "Content-Type: application/json" \
      -d '{"message": "Should I long or short ETH right now? Check technicals, funding rates, and macro. Respond as JSON with: direction, entry_price, stop_loss, take_profit_1, take_profit_2, risk_reward_ratio, confidence, reasoning"}'
    ```
  </Tab>
</Tabs>

The response comes back in the `content` field (not `message`). Add "Respond as JSON with:" to any query and specify the fields you want - the `content` field will contain parseable JSON instead of markdown.

## Find Squeeze Setups

Scan for tokens where positioning is extreme and a liquidation cascade could trigger a move.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    response = requests.post(
        "https://api.gigabrain.gg/v1/chat",
        headers={"Authorization": "Bearer gb_sk_..."},
        json={
            "message": "Find tokens with extreme funding rates and crowded positioning that could squeeze. Respond as JSON array with: symbol, funding_rate, open_interest, long_short_ratio, squeeze_direction, liquidation_risk, catalyst"
        },
        timeout=600
    )

    squeezes = json.loads(response.json()["content"])
    for s in squeezes:
        print(f"{s['symbol']}: {s['squeeze_direction']} squeeze, funding {s['funding_rate']}")
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const res = await fetch("https://api.gigabrain.gg/v1/chat", {
      method: "POST",
      headers: {
        Authorization: "Bearer gb_sk_...",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        message: "Find tokens with extreme funding rates and crowded positioning that could squeeze. Respond as JSON array with: symbol, funding_rate, open_interest, long_short_ratio, squeeze_direction, liquidation_risk, catalyst",
      }),
      signal: AbortSignal.timeout(600000),
    });

    const squeezes = JSON.parse((await res.json()).content);
    squeezes.forEach((s) =>
      console.log(`${s.symbol}: ${s.squeeze_direction} squeeze, funding ${s.funding_rate}`)
    );
    ```
  </Tab>
</Tabs>

## Screen for Macro Risk

Check if macro conditions support risk-on or if you should be reducing exposure.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    response = requests.post(
        "https://api.gigabrain.gg/v1/chat",
        headers={"Authorization": "Bearer gb_sk_..."},
        json={
            "message": "What's the current macro risk regime for crypto? Factor in DXY, yields, VIX, and equities. Respond as JSON with: risk_regime, dxy_trend, vix_level, yield_curve_signal, equity_correlation, recommended_exposure, reasoning"
        },
        timeout=600
    )

    macro = json.loads(response.json()["content"])
    print(f"Regime: {macro['risk_regime']} | Exposure: {macro['recommended_exposure']}")
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const res = await fetch("https://api.gigabrain.gg/v1/chat", {
      method: "POST",
      headers: {
        Authorization: "Bearer gb_sk_...",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        message: "What's the current macro risk regime for crypto? Factor in DXY, yields, VIX, and equities. Respond as JSON with: risk_regime, dxy_trend, vix_level, yield_curve_signal, equity_correlation, recommended_exposure, reasoning",
      }),
      signal: AbortSignal.timeout(600000),
    });

    const macro = JSON.parse((await res.json()).content);
    console.log(`Regime: ${macro.risk_regime} | Exposure: ${macro.recommended_exposure}`);
    ```
  </Tab>
</Tabs>

## Spot Early Narratives

Find narratives gaining momentum before they go mainstream.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    response = requests.post(
        "https://api.gigabrain.gg/v1/chat",
        headers={"Authorization": "Bearer gb_sk_..."},
        json={
            "message": "What crypto narratives are gaining momentum right now? Rank by strength. Respond as JSON array with: narrative, momentum_score, top_tokens, sentiment, key_catalyst, risk_level"
        },
        timeout=600
    )

    narratives = json.loads(response.json()["content"])
    for n in narratives[:5]:
        print(f"{n['narrative']} (momentum: {n['momentum_score']}/100) - {', '.join(n['top_tokens'])}")
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const res = await fetch("https://api.gigabrain.gg/v1/chat", {
      method: "POST",
      headers: {
        Authorization: "Bearer gb_sk_...",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        message: "What crypto narratives are gaining momentum right now? Rank by strength. Respond as JSON array with: narrative, momentum_score, top_tokens, sentiment, key_catalyst, risk_level",
      }),
      signal: AbortSignal.timeout(600000),
    });

    const narratives = JSON.parse((await res.json()).content);
    narratives.slice(0, 5).forEach((n) =>
      console.log(`${n.narrative} (momentum: ${n.momentum_score}/100) - ${n.top_tokens.join(", ")}`)
    );
    ```
  </Tab>
</Tabs>

<Card title="SuperAgents API" icon="robot" href="/developers/superagents-api">
  Want always-on agents instead? Launch, manage, and chat with autonomous trading agents programmatically.
</Card>

<Warning>
  Gigabrain provides market intelligence tools, not financial advice. Always do your own research before trading. See the [Risk Disclosure](/support/risk-disclosure).
</Warning>
