Tengu Brain

Brain is an OpenAI/Anthropic-compatible agent that orchestrates the FIRM data products for you. You send one natural-language request; Brain plans the work, calls the right FIRM tools server-side, and returns a synthesized answer — you write no tool-calling code.

What Brain is#

The FIRM data API gives you 15 raw products and leaves the orchestration to you. Brain flips that: it holds the full FIRM tool suite and decides — per request — which endpoints to call, in what order, and how to fuse the results. A single prompt like "What did Nancy Pelosi trade recently, and how did NVDA move around those dates?" becomes, internally, a congressional-trades lookup + a market-data pull + a synthesis — none of which you orchestrate.

Because Brain speaks the OpenAI and Anthropic wire formats, you point your existing SDK at it and change only the base_url and model. No new client, no tool schemas to maintain.

Base URLhttps://brain.tengu.co/v1
AuthAuthorization: Bearer tengu_... (same key as FIRM)
Modelbrain
ShapesPOST /v1/chat/completions (OpenAI) · POST /v1/messages (Anthropic)
Billingper token, against the shared credit wallet
PlanEnterprise

Requirements#

Brain requires the Enterprise plan — it has autonomous access to the entire FIRM product suite, so it is bundled at the tier that includes every product. On any lower plan a Brain request returns 402 plan_required:

JSON
{ "detail": { "error_code": "plan_required", "error_message": "your plan '...' does not include 'brain' — upgrade to Enterprise to access it. Manage your plan at https://app.tengu.co", "tool_group": "brain", "current_plan": "pro", "unlocked_by": ["enterprise"], "upgrade_url": "https://app.tengu.co" } }

On Pro and below, call the FIRM data endpoints directly. You get the same underlying data (quotes, congressional trades, private markets, quant signals) — you just orchestrate the calls yourself. See the Quickstart and API Reference.

Endpoints#

MethodPathShape
POST/v1/chat/completionsOpenAI Chat Completions (model: "brain")
POST/v1/messagesAnthropic Messages

Both support streaming with stream: true. Brain is stateless per request — there are no server-side sessions; you carry the conversation by sending the full messages[] history on every turn, exactly like OpenAI and Anthropic.

Using Brain#

OpenAI Python SDK#

Point the official SDK at Brain — only base_url and model change:

Python
1import os2from openai import OpenAI3 4client = OpenAI(api_key=os.environ["TENGU_API_KEY"], base_url="https://brain.tengu.co/v1")5 6resp = client.chat.completions.create(7    model="brain",8    messages=[{"role": "user",9               "content": "What did Nancy Pelosi trade recently, and how did NVDA move around those dates?"}],10)11print(resp.choices[0].message.content)

Raw HTTP (curl)#

Shell
1curl https://brain.tengu.co/v1/chat/completions \2  -H "Authorization: Bearer $TENGU_API_KEY" \3  -H "Content-Type: application/json" \4  -d '{5    "model": "brain",6    "messages": [{"role": "user", "content": "Summarize unusual options flow in TSLA today and any related dark-pool prints."}]7  }'

Streaming#

Python
1stream = client.chat.completions.create(2    model="brain",3    messages=[{"role": "user", "content": "Give me a bull vs bear case on PLTR with the latest 13F changes."}],4    stream=True,5)6for chunk in stream:7    delta = chunk.choices[0].delta.content8    if delta:9        print(delta, end="", flush=True)

Anthropic shape#

If your stack speaks the Anthropic Messages API, use /v1/messages unchanged:

Shell
1curl https://brain.tengu.co/v1/messages \2  -H "Authorization: Bearer $TENGU_API_KEY" \3  -H "Content-Type: application/json" \4  -d '{5    "model": "brain",6    "max_tokens": 1024,7    "messages": [{"role": "user", "content": "Which private AI companies raised the largest rounds this quarter?"}]8  }'

Billing#

Brain is metered per token against the same credit wallet as FIRM. Each turn's list-price cost is converted to credits at 2,500 credits per $1 (≈ $0.0004/credit).

One request is a single metered event. No matter how many FIRM tools Brain calls internally to answer you, you are billed once — for the tokens of your request and its response. You are not separately charged for the FIRM endpoints Brain invokes on your behalf.

When the wallet is exhausted, Brain returns 402 usage_exceeded (top up or upgrade in the dashboard). Errors never debit credits.

Statelessness & context#

Brain keeps no server-side conversation state. To continue a conversation, resend the full messages[] history each turn — the same contract as OpenAI/Anthropic. This makes Brain horizontally scalable and safe to call from stateless environments (serverless, agents, cron).

Next steps#