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.
https://cognitivedaniel.com/api/v1All 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.
X-API-Key: cog_live_eyJjaWQiOiJhY21lX2NvcnAi... # or Authorization: Bearer cog_live_eyJjaWQiOiJhY21lX2NvcnAi...
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
Rate limit headers are included on every response: X-RateLimit-Limit and X-RateLimit-Remaining. When exceeded, the API returns HTTP 429.
Endpoints
Returns the full catalog of agents your key has access to.
curl https://cognitivedaniel.com/api/v1/agents \ -H "X-API-Key: YOUR_KEY"
{
"object": "list",
"data": [
{ "id": "engineer", "name": "Engineer", "description": "Autonomous software engineering..." },
{ "id": "pm", "name": "Pm", "description": "Program management..." },
...
],
"total": 16,
"plan": "growth"
}
The core endpoint. Choose an agent, send a conversation, get an expert reply. Supports both one-shot and streaming.
Request body
| Parameter | Type | Description |
|---|---|---|
| agent required | string | Agent ID — see agent catalog below |
| messages required | array | Array of {"role":"user"|"assistant","content":"..."} objects |
| stream optional | boolean | Stream response as Server-Sent Events (default: false) |
| system_context optional | string | Extra instructions appended to the agent's system prompt (max 4,000 chars) |
| knowledge optional | string | Persistent context about your company, codebase, or team (max 8,000 chars) |
| max_tokens optional | number | Cap on response length (default 8,000; max 16,000) |
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."
}'
{
"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"
}
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);
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"])
Convert any text to natural-sounding speech. Returns an mp3 binary stream.
Request body
| Parameter | Type | Description |
|---|---|---|
| text required | string | Text to synthesize (max 4,096 chars) |
| voice optional | string | alloy · echo · fable · nova · onyx · shimmer (default: alloy) |
| speed optional | number | Playback speed 0.25–4.0 (default: 1.0) |
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.
Standard OpenAI chat completions format with streaming support. Base URL: https://cognitivedaniel.com/api/v1/openai
Request body
| Field | Type | Notes |
|---|---|---|
| model | string | Use cognitive-<agent> — e.g. cognitive-anna, cognitive-engineer |
| messages | array | Standard OpenAI messages array (role + content) |
| stream optional | boolean | Set true to receive SSE chunks in OpenAI delta format |
| max_tokens optional | integer | Max tokens in the response |
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 -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
}'
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.
Note: this path is not under /api/v1/ — it's at the root of the API.
Tools exposed
| Tool | Description |
|---|---|
list_agents | Returns all available agents and their capabilities |
run_agent | Run any agent with a task and optional context |
get_usage | Returns this month's calls, tokens and cost on your key |
{
"mcpServers": {
"cognitive": {
"type": "http",
"url": "https://cognitivedaniel.com/api/mcp/cognitive",
"headers": { "Authorization": "Bearer YOUR_COGNITIVE_API_KEY" }
}
}
}
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].
data: {"delta": "I found"}
data: {"delta": " two issues"}
data: {"delta": " with this function:"}
...
data: [DONE]
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.
Error Codes
| HTTP Status | Code | Meaning |
|---|---|---|
| 400 | Bad Request | Missing required field or invalid agent ID |
| 401 | Unauthorized | Missing, expired, or revoked API key |
| 429 | Too Many Requests | Rate limit exceeded — retry after 1 minute or upgrade plan |
| 500 | Internal Error | Unexpected server error — contact support |
| 502 | Bad Gateway | Could not reach the AI model — transient, retry with backoff |
| 503 | Service Unavailable | Feature 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
// 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)
});
# 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
# 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)"'"
}'
Contact dan@cognitivedaniel.com for enterprise pricing and a technical scoping call.