PsyCortex API.
Drop-in OpenAI compatible.
REST API. Bearer auth. Same INR wallet as the Lab — every call debits credits at 2× Lab pricing (Hobby), 1.5× (Builder), 1.2× (Scale), 1.0× (Sovereign). Point your OpenAI SDK at our baseURL and ship.
One Bearer token. Legacy formats still valid.
Base URL: https://bharatneurotech.com/api/public/v1. Mint a key in /billing → API Keys. New tokens are issued as psycortex_live_…. Existing neurocortex_v3_live_…, neurocortex_v2_live_… and nck_live_… keys continue to work — no rotation required. The full token is shown once; only its SHA-256 hash is stored.
Authorization: Bearer psycortex_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Content-Type: application/json
Swap the baseURL — keep your code.
// Node — OpenAI SDK
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.PSYCORTEX_KEY,
baseURL: "https://bharatneurotech.com/api/public/v1",
});
const out = await client.chat.completions.create({
model: "psycortex-v3",
messages: [{ role: "user", content: "Audit this AI policy clause: ..." }],
max_tokens: 16384, // see §5 — model-card maximum
});# Python — openai
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PSYCORTEX_KEY"],
base_url="https://bharatneurotech.com/api/public/v1",
)
out = client.chat.completions.create(
model="psycortex-v3",
messages=[{"role": "user", "content": "..."}],
max_tokens=16384,
)# curl — non-stream
curl -sS https://bharatneurotech.com/api/public/v1/chat/completions \
-H "Authorization: Bearer $PSYCORTEX_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "psycortex-v3",
"messages": [{"role":"user","content":"One-line summary of ISO 42001."}],
"max_tokens": 1024
}'
# curl — streaming (SSE)
curl -N https://bharatneurotech.com/api/public/v1/chat/completions \
-H "Authorization: Bearer $PSYCORTEX_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"psycortex-v3","stream":true,"messages":[{"role":"user","content":"hi"}]}'
# curl — PsyCortex (400B+, multimodal reasoning)
# Accepts native `system` role. Upstream defaults: temperature=0.6, top_p=0.95, max_tokens up to 32768.
curl -sS https://bharatneurotech.com/api/public/v1/chat/completions \
-H "Authorization: Bearer $PSYCORTEX_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "psycortex",
"messages": [
{"role":"system","content":"You are a warm, empathetic writing partner."},
{"role":"user","content":"Draft a gentle nudge email to a lapsed customer."}
]
}'
# curl — health probe (no auth)
curl -sS https://bharatneurotech.com/api/public/v1/healthTwo model aliases. Same OpenAI-compatible endpoint.
| Model id | Best for | Context | Default max_tokens |
|---|---|---|---|
| psycortex | Default. 400B+ parameters, 20B+ active, proprietary sparse attention. Natively multimodal on text + images (up to 12 images per message) — decoding, vision, deep reasoning, EQ and coding in one engine. | Infinite Context Window · up to 100 billion tokens/request (PsyMemory — proprietary; 100B on paid API sync path, higher via async) | 16384 |
| psycortex-codemaster | Code-tuned alias of PsyCortex. Refactor, review, multi-file MVP scaffolds. India's rival to GPT Codex / Claude Code / Qwen Code / Jules. | Infinite Context Window · up to 100 billion tokens/request (PsyMemory — proprietary; 100B on paid API sync path, higher via async) | 16384 |
| psycortex-vision-physical | PsyVision alias — physical-scene reasoning over images (space, time, causality, next-step planning). Runs on the PsyCortex engine; images only, no video or audio. | same as psycortex | 4096 |
| psycortex-v3 | Legacy alias for `psycortex`. Retained for backwards compatibility. | same as psycortex | 16384 |
psycortex-codemaster is the code-tuned alias of PsyCortex — Bharat NeuroTech's rival to GPT Codex, Claude Code, Qwen Code and Google Jules. The server auto-injects a code-only system prompt (refactor / review / scaffold runnable multi-file MVPs), defaults max_tokens to the model-card maximum of 16384, and emits OpenAI-shape responses with model: "psycortex-codemaster". Try it interactively at /codemaster.
// CodeMaster — scaffold a runnable MVP
const out = await client.chat.completions.create({
model: "psycortex-codemaster",
messages: [{ role: "user", content: "Scaffold a Node + Express RAG chat that calls PsyCortex." }],
max_tokens: 16384, // CodeMaster default — model-card maximum output
});All endpoints under /api/public/v1
| Method | Path | Description | Cost |
|---|---|---|---|
| GET | /v1/health | Unauthenticated liveness probe. Returns { ok, engine, version, ts }. Safe for uptime monitors. | free |
| POST | /v1/chat/completions | OpenAI-compatible Chat Completions. Streaming + non-streaming. Accepts model (psycortex | psycortex-codemaster | psycortex-vision-physical | psycortex-v3 [legacy]), messages, temperature, top_p, max_tokens, stream, stop, plus the PsyCortex modes block. Content parts accept text and image_url only (https URL or data: base64, max 12 images per message); video_url, input_audio and file parts are rejected with 400. | ₹0.50 base (chat) · +₹2 vision-turn surcharge · +₹1/image · ×tier multiplier |
| GET | /v1/models | OpenAI-compatible model list. Returns psycortex (default) and psycortex-codemaster. | free |
| GET | /v1/psycortex/models | Extended model list with capability tags and default_max_tokens. | free |
| POST | /v1/psycortex/scan | Vision · image understanding (URL or base64). Non-OpenAI; multimodal extension. | ₹3 · ×multiplier |
| POST | /v1/psycortex/listen | Audio/video transcription + analysis per minute. | ₹3–4/min · ×multiplier |
| GET | /v1/psycortex/account | Wallet balance + daily usage on this key. | free |
| GET | /v1/psycortex/plan | Tier + multiplier + daily cap on this key. | free |
| POST | /v1/psycortex/chat | DEPRECATED — alias of /v1/chat/completions with the legacy { engine, message } envelope. Sends a Deprecation header. | same as /v1/chat/completions |
Three explicit toggles. Off by default.
Reasoning, agent tools and web search add latency. They are explicitly disabled on every API call unless you opt in. Set them via the OpenAI-safe extension field psycortex on the chat body (OpenAI SDKs forward unknown JSON fields untouched):
{
"model": "psycortex-v3",
"messages": [...],
"max_tokens": 16384,
"psycortex": {
"deep_thinking": false, // engine called with thinking:false (≈ 1.5–4× faster)
"agent_mode": false, // tool_choice forced to "none"
"web_access": false // web tool stripped from tool list
}
}Default is the model-card maximum: 16384.
PsyCortex is a reasoning-class engine. Setting max_tokens below 1024 is the number-one cause of empty responses — the engine spends its budget on internal reasoning and runs out before emitting the visible answer. The API now defaults to the engine's maximum supported output length so this is no longer a footgun.
- Default if omitted:
16384(model-card max). - Minimum accepted:
256(anything lower →400 invalid_request). - Maximum accepted:
16384(engine cap; requests above are clamped). - If the engine returns empty content with
finish_reason:"length"the API auto-refunds and returns502 empty_response_increase_max_tokens.
OpenAI-shape SSE with reasoning stripped.
Set stream: true. Response is text/event-stream with data: {…} chunks of object:"chat.completion.chunk" and a terminating data: [DONE]. Cost is debited up-front. If the stream ends with zero visible content deltas, the debit is auto-refunded (upstream failures, empty completions). Reasoning-only frames are suppressed; you never see reasoning_content or <think>…</think> blocks in the output.
Multi-file MVP scaffolds via the standard endpoint.
Send model: "psycortex-codemaster" to /v1/chat/completions. The server auto-injects the CodeMaster system prompt (refactor / review / scaffold runnable multi-file MVPs) and defaults max_tokens to 16384. Every API response is a single OpenAI-shape chat completion — the interactive multi-file Artifact Build Loop (planner + per-file executor + workspace preview) is currently exposed at /codemaster only. Public-API build-loop support ships next; it will bill each planner and per-file call at ₹0.50 (before tier multiplier) alongside the base completion.
What terminates a response, and how to trace it.
stop— model reached a natural stop or astopsequence.length— hitmax_tokens. Increasemax_tokensand retry.tool_calls— model emitted a tool call (only whenagent_modeis on and tools are attached).content_filter— output was blocked by safety filters.
Every response carries an X-Request-Id header. Include it in support requests to trace a specific call. Legacy /v1/neurocortex/* paths still work but return a Deprecation header — migrate to /v1/psycortex/* (or /v1/chat/completions for chat).
Same wallet as the Lab. Tier multipliers apply.
- Hobby — 2× Lab price, ₹5,000/day cap (default).
- Builder — 1.5×, ₹50,000/day cap.
- Scale — 1.2×, ₹2,50,000/day cap.
- Sovereign — 1.0× (no markup), ₹10,00,000/day cap.
Wallet balance is checked before the upstream call. Low balance returns 402 instantly — no time wasted on a doomed model round-trip. Failed handlers auto-refund. Hard daily caps are atomic at the database.
Standard JSON envelope.
{ "error": { "code": "insufficient_credits", "message": "Wallet has insufficient credits" },
"engine": "psycortex" }max_tokens < 256Real-time usage + 402 events.
Set webhook_url on a key (Builder+ tier) to receive usage.debit and 402.insufficient_credits events. Payloads are HMAC-signed; verify the X-PsyCortex-Signature header.
