API v1 · Live

Cognitive AI API

Integrate 16 specialized AI agents — engineer, PM, legal, finance, compliance, and more — directly into your product, pipeline, or backend. One key. One endpoint. Any agent.

Overview

The Cognitive AI API gives your company access to the same autonomous agents powering cognitivedaniel.com. Every agent operates at senior-expert level in its domain and follows a structured understand → plan → produce → verify workflow before returning output.

Base URL: https://cognitivedaniel.com/api/v1
All requests are HTTPS. Responses are JSON unless you request a binary (TTS returns audio/mpeg).

Authentication

Every request must include your API key. Pass it as the X-API-Key header (preferred) or as a Bearer token in Authorization.

Request headers
X-API-Key: cog_live_eyJjaWQiOiJhY21lX2NvcnAi...
# or
Authorization: Bearer cog_live_eyJjaWQiOiJhY21lX2NvcnAi...
Keep keys secret. Never expose your API key in client-side JavaScript, mobile apps, or public repos. Route all API calls through your backend.

To request an API key, email dan@cognitivedaniel.com with your company name, use case, and expected volume. Keys are provisioned within one business day.

Plans & Rate Limits

Starter
20 req/min
Pilot projects & prototypes
Enterprise
1,000 req/min
Custom SLAs available

Rate limit headers are included on every response: X-RateLimit-Limit and X-RateLimit-Remaining. When exceeded, the API returns HTTP 429.

Endpoints

GET /v1/agents List all available agents

Returns the full catalog of agents your key has access to.

cURL
curl https://cognitivedaniel.com/api/v1/agents \
  -H "X-API-Key: YOUR_KEY"
Response
{
  "object": "list",
  "data": [
    { "id": "engineer", "name": "Engineer", "description": "Autonomous software engineering..." },
    { "id": "pm",       "name": "Pm",       "description": "Program management..." },
    ...
  ],
  "total": 16,
  "plan": "growth"
}
POST /v1/chat Send a message to any agent

The core endpoint. Choose an agent, send a conversation, get an expert reply. Supports both one-shot and streaming.

Request body

ParameterTypeDescription
agent requiredstringAgent ID — see agent catalog below
messages requiredarrayArray of {"role":"user"|"assistant","content":"..."} objects
stream optionalbooleanStream response as Server-Sent Events (default: false)
system_context optionalstringExtra instructions appended to the agent's system prompt (max 4,000 chars)
knowledge optionalstringPersistent context about your company, codebase, or team (max 8,000 chars)
max_tokens optionalnumberCap on response length (default 8,000; max 16,000)
cURL — one-shot
curl -X POST https://cognitivedaniel.com/api/v1/chat \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent": "engineer",
    "messages": [
      { "role": "user", "content": "Review this function for bugs:\n\nfunction divide(a,b){ return a/b; }" }
    ],
    "knowledge": "We use TypeScript. All functions must handle edge cases and throw typed errors."
  }'
Response (non-streaming)
{
  "object": "chat.completion",
  "agent": "engineer",
  "content": "I found two issues:\n\n1. **Division by zero** — `b` is not checked...",
  "usage": { "input_tokens": 48, "output_tokens": 312 },
  "model": "claude-sonnet-5-5"
}
Node.js example
const res = await fetch('https://cognitivedaniel.com/api/v1/chat', {
  method: 'POST',
  headers: { 'X-API-Key': process.env.COGNITIVE_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    agent: 'pm',
    messages: [{ role: 'user', content: 'Write a sprint retrospective for a 2-week sprint where we shipped auth and missed the dashboard.' }],
    knowledge: 'Our team uses Jira. We are a 6-person SaaS startup building a B2B analytics platform.'
  })
});
const { content } = await res.json();
console.log(content);
Python example
import requests, os

resp = requests.post(
    "https://cognitivedaniel.com/api/v1/chat",
    headers={"X-API-Key": os.environ["COGNITIVE_API_KEY"]},
    json={
        "agent": "legal",
        "messages": [{"role": "user", "content": "Flag any high-risk clauses in this NDA excerpt:\n\n[paste NDA text here]"}],
        "system_context": "We are a Series A SaaS company. Flag IP ownership and non-compete clauses as HIGH risk."
    }
)
print(resp.json()["content"])
POST /v1/tts Text-to-speech — returns audio/mpeg

Convert any text to natural-sounding speech. Returns an mp3 binary stream.

Request body

ParameterTypeDescription
text requiredstringText to synthesize (max 4,096 chars)
voice optionalstringalloy · echo · fable · nova · onyx · shimmer (default: alloy)
speed optionalnumberPlayback speed 0.25–4.0 (default: 1.0)
cURL — save to file
curl -X POST https://cognitivedaniel.com/api/v1/tts \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Welcome to Cognitive AI. Your autonomous team is ready.","voice":"nova"}' \
  --output reply.mp3

OpenAI-compatible API

Drop-in replacement for OpenAI's chat completions endpoint. Swap your base URL and use any Cognitive agent as the model name.

POST /v1/openai/chat/completions

Standard OpenAI chat completions format with streaming support. Base URL: https://cognitivedaniel.com/api/v1/openai

Request body

FieldTypeNotes
modelstringUse cognitive-<agent> — e.g. cognitive-anna, cognitive-engineer
messagesarrayStandard OpenAI messages array (role + content)
stream optionalbooleanSet true to receive SSE chunks in OpenAI delta format
max_tokens optionalintegerMax tokens in the response
OpenAI SDK — drop-in
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'YOUR_COGNITIVE_API_KEY',
  baseURL: 'https://cognitivedaniel.com/api/v1/openai',
});

const response = await client.chat.completions.create({
  model: 'cognitive-anna',
  messages: [{ role: 'user', content: 'Summarize the risks in our Q3 plan.' }],
  stream: true,
});

for await (const chunk of response) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}
curl
curl -X POST https://cognitivedaniel.com/api/v1/openai/chat/completions \
  -H "Authorization: Bearer YOUR_COGNITIVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cognitive-legal",
    "messages": [{"role":"user","content":"Flag any unusual clauses in this NDA."}],
    "stream": false
  }'
GET /v1/openai/models

Returns all available Cognitive agents in OpenAI model-list format. Each model ID is cognitive-<agent>.

MCP Server

A hosted Model Context Protocol server (Streamable HTTP, JSON-RPC 2.0). Lets AI editors like Claude Code, Cursor, and VS Code Copilot call your agents as tools.

POST /api/mcp/cognitive

Note: this path is not under /api/v1/ — it's at the root of the API.

Tools exposed

ToolDescription
list_agentsReturns all available agents and their capabilities
run_agentRun any agent with a task and optional context
get_usageReturns this month's calls, tokens and cost on your key
Claude Code — add to mcp.json
{
  "mcpServers": {
    "cognitive": {
      "type": "http",
      "url": "https://cognitivedaniel.com/api/mcp/cognitive",
      "headers": { "Authorization": "Bearer YOUR_COGNITIVE_API_KEY" }
    }
  }
}
Or install the npm package
npx cognitive-ai-mcp claude YOUR_COGNITIVE_API_KEY

Streaming

Pass "stream": true on /v1/chat. The response is a text/event-stream of Server-Sent Events. Each event contains a delta chunk; the final event is [DONE].

Streaming event format
data: {"delta": "I found"}
data: {"delta": " two issues"}
data: {"delta": " with this function:"}
...
data: [DONE]
Node.js — streaming
const res = await fetch('https://cognitivedaniel.com/api/v1/chat', {
  method: 'POST',
  headers: { 'X-API-Key': process.env.COGNITIVE_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({ agent: 'engineer', messages: [{role:'user',content:'Refactor this code...'}], stream: true })
});

const reader = res.body.getReader();
const decoder = new TextDecoder();
let buf = '';
while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  buf += decoder.decode(value, { stream: true });
  const lines = buf.split('\n'); buf = lines.pop();
  for (const line of lines) {
    if (!line.startsWith('data:')) continue;
    const payload = line.slice(5).trim();
    if (payload === '[DONE]') break;
    const { delta } = JSON.parse(payload);
    process.stdout.write(delta);
  }
}

Agent Catalog

Pass any of these IDs as the agent field.

engineer
Software Engineering
pm
Program Management
ba
Business Analysis
legal
Legal Research
finance
Financial Analysis
recruiter
Talent Acquisition
content
Content Creation
support
Customer Support
revenue
Sales Intelligence
compliance
Risk & Compliance
qa
Quality Assurance
testing
Test Automation
devops
DevOps
deploy
Release Planning
infra
Cloud Infrastructure
monitoring
Observability

Error Codes

HTTP StatusCodeMeaning
400Bad RequestMissing required field or invalid agent ID
401UnauthorizedMissing, expired, or revoked API key
429Too Many RequestsRate limit exceeded — retry after 1 minute or upgrade plan
500Internal ErrorUnexpected server error — contact support
502Bad GatewayCould not reach the AI model — transient, retry with backoff
503Service UnavailableFeature not configured (e.g. TTS key not set)

All error responses follow the same shape:

{ "error": "Human-readable message describing what went wrong." }

Enterprise Integration

Cognitive AI is built to connect to your team's existing stack. The knowledge parameter on /v1/chat is your integration layer — pass in your company context, codebase conventions, team standards, or live data, and every agent operates within your world.

Common integration patterns

Pattern 1 — Inject live context
// Pull your sprint data from Jira, pass it to the PM agent
const jiraContext = await fetchCurrentSprint(); // your call
const { content } = await cognitiveChat({
  agent: 'pm',
  messages: [{ role: 'user', content: 'Write an executive status update for this sprint.' }],
  knowledge: JSON.stringify(jiraContext)
});
Pattern 2 — Code review on every PR
# GitHub Actions — call cognitive engineer on every pull request
- name: AI Code Review
  run: |
    DIFF=$(git diff origin/main...HEAD)
    curl -s -X POST https://cognitivedaniel.com/api/v1/chat \
      -H "X-API-Key: $COGNITIVE_API_KEY" \
      -H "Content-Type: application/json" \
      -d "{\"agent\":\"engineer\",\"messages\":[{\"role\":\"user\",\"content\":\"Review this diff for bugs, security issues, and performance problems:\n\n$DIFF\"}]}" \
      | jq -r .content >> review.md
    gh pr comment --body-file review.md
Pattern 3 — Compliance scan
# Pass your policy docs, get a gap analysis against SOC 2
curl -X POST https://cognitivedaniel.com/api/v1/chat \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent": "compliance",
    "messages": [{"role":"user","content":"Audit these policies against SOC 2 Type II controls and flag all gaps."}],
    "knowledge": "'"$(cat your-policies.txt)"'"
  }'
Need a dedicated instance, custom SLA, SSO, or on-prem deployment?
Contact dan@cognitivedaniel.com for enterprise pricing and a technical scoping call.
© 2026 Cognitive AI · cognitivedaniel.com