KIDUNA DEVELOPER PLATFORM
Use a Kiduna integration key to add safe AI chat to your app, inspect your available Skills, or connect an MCP client to your live Kiduna MCP tools.
kiduna_ik_••••••••verifiedAnswer-only LLM chat for your application.
Explore chat API keysCreate and manage your global credential in Kiduna Settings.
Open Kiduna SettingsCHOOSE THE RIGHT INTERFACE
01 — START HERE/v1/chatOne answer-only LLM response.
/v1/ws/chatPersistent answer-only chat.
/v1/skillsRead the Skills visible to the key owner.
/mcp/Discover and use the live, permission-aware MCP tools.
THE SIMPLEST START
02 — 5 MINUTESIn Kiduna Settings, create a global integration key and copy it immediately.
Put it in a server-side environment variable or secret manager—never a browser app.
Call /v1/capabilities to see which public interfaces this key can use.
GETTING STARTED
This guide sends one answer-only chat message. You need a Kiduna account, an active integration key, and the public agent-service address for your deployment.
Open Kiduna Settings, find Global API access, create a key, and copy the secret. The secret is shown once, so save it in your password manager or secret manager before closing the dialog.
Set KIDUNA_BASE_URL to the HTTPS address of your Kiduna agent service and KIDUNA_API_KEY to the key. Keep both values on your server; do not expose the key in browser code, a mobile app, or a public repository.
Call GET /v1/capabilities. A successful response tells you whether generic chat, selected-agent chat, and Skills access are available. If it returns 401, check that you sent Authorization: Bearer ….
Send a non-empty message to POST /v1/chat. Use an idempotency key if your application might retry a request after a timeout.
Save the returned request_id in your own logs. It identifies this request when you need to troubleshoot a result or a retry.
AUTHENTICATION
Every public HTTP, WebSocket, and MCP request uses a Kiduna integration key. The server verifies the key, its lifecycle state, scopes, and the owner’s current access each time it is used.
Send the key only in the standard Bearer header. Do not use a query parameter, X-API-Key, or a plain Authorization value.
Authorization: Bearer kiduna_ik_<your-secret>
/v1/meReturns the authenticated wallet. Use this to confirm which Kiduna account your service key represents.
/v1/capabilitiesReturns whether chat and Skills reads are currently available, plus the integration’s current permission details.
{
"chat": true,
"skills_read": true,
"agents_read": true,
"agents_chat": true,
"integration": { "scopes": ["chat.send", "skills.read", "agents.read", "agents.chat"] },
"scope": "authenticated_person"
}The exact integration object can include additional account-specific fields. Treat it as an access result, not as a permanent grant—permissions may change later.
The next request fails authentication, including a message sent over an already-open WebSocket.
The old secret stops working. Update your secret manager before sending another request.
The next MCP discovery or tool call sees the current account state and Tool Book.
A key without the required scope receives 403; do not retry until its access is changed.
LLM API
Send a message and receive one answer-only LLM response. The chat endpoint does not access tools, account data, DUNAs, or connected services.
/v1/chatchat.sendPass the integration key in the Authorization header. The JSON body has one required field: message, a non-empty string up to 6,000 characters. The entire HTTP request body is limited to 24 KB. Idempotency-Key is optional, must be 8–128 characters when supplied, and lets a retry receive the original result rather than beginning another LLM call.
{
"response": "An API key is a secret credential…",
"mode": "read_only",
"request_id": "req_…"
}Use this flow when you want a specific existing Kiduna agent rather than the generic assistant. First discover the active agents available to the key owner with GET /v1/agents and the agents.read scope. The response contains only accessible Presence agents; it does not expose private agents belonging to others, Workers, or inactive agents.
GET /v1/agents
Authorization: Bearer kiduna_ik_…
{ "agents": [{ "id": "research-assistant", "name": "Research Assistant",
"mode": "answer_only", "transports": ["http", "wss"] }] }Then use the returned ID with agents.chat:
POST /v1/agents/research-assistant/chat
Authorization: Bearer kiduna_ik_…
Content-Type: application/json
Idempotency-Key: research-turn-001
{ "message": "Summarise the approved research." }{
"agent": { "id": "research-assistant", "name": "Research Assistant" },
"response": "The approved research identifies three main findings…",
"mode": "answer_only",
"request_id": "req_…"
}Use one unique idempotency key for one logical user action. If the network fails after you send a request, resend the same message with the same key. Reusing a key with a different message returns 409. A request whose final status is not yet known can return 202 or 409 with its request_id; do not create a new request just because a response was delayed.
LLM API
Keep an answer-only chat connection open for interactive applications.
/v1/ws/chatchat.sendConnect to wss://<agent-host>/v1/ws/chat. A server-side WebSocket client may send Authorization: Bearer … during the handshake. Browser WebSocket APIs cannot set that header, so send the authentication frame within 20 seconds of connecting. Never put an API key in a URL.
{ "type": "authenticate", "apiKey": "kiduna_ik_…" }For generic chat, send a message only:
{ "type": "chat", "message": "Explain rate limiting.", "idempotencyKey": "chat-001" }For a selected existing agent, first use GET /v1/agents over HTTP with agents.read. Then include one returned agentId on each chat frame. This requires agents.chat.
{
"type": "chat",
"agentId": "research-assistant",
"message": "What are the three main findings?",
"idempotencyKey": "research-turn-002"
}Generic chat returns:
{ "type": "response", "response": "Rate limiting controls…", "mode": "read_only", "request_id": "req_…" }Selected-agent chat identifies the actual agent:
{ "type": "response", "agent": { "id": "research-assistant", "name": "Research Assistant" }, "response": "…", "mode": "answer_only", "request_id": "req_…" }First send one authenticate frame. Wait for the authenticated response, then send one or more chat frames. For a selected agent, provide its ID on each frame. ping returns pong. Invalid frames return an error event. The API rechecks the key, scope, and selected agent access for every chat message, so disable, delete, recreate, or access removal takes effect without waiting for the socket to close.
LLM API
Inspect Skill definitions visible to the API-key owner. This is a read-only HTTP API; Skills are never run automatically by chat.
/v1/skillsskills.readGET /v1/skills?page=1&page_size=20. Include the same Authorization: Bearer … header used for chat. The endpoint returns only library Skills owned by the authenticated wallet; background template instances are not included.
integerOptional. Page number, starting at 1. Values below 1 return 422.
integerOptional. Number of Skills per page. Allowed range: 1–100; default: 20.
{
"skills": [{
"id": "skill_…", "name": "Weekly review", "trigger_type": "scheduled",
"when_text": "Every Monday", "then_text": "Prepare a review",
"tools": [], "skill_content": "…", "status": "active",
"cron_expression": "0 9 * * 1", "poll_interval_sec": null,
"requires_approval": true, "realm_id": null,
"created_at": "…", "updated_at": "…"
}],
"total": 1, "page": 1, "page_size": 20
}GET /v1/skills/{skill_id}.null.null.GET /v1/skills/{skill_id}. Replace skill_id with an ID returned by the list endpoint. There are no query parameters. The response is one Skill object with the fields above. An unknown, unavailable, or non-owned ID returns 404 with { "error": "skill_not_found" }.
MCP
Find the right Kiduna tool, see what it is for, and open it for the required inputs. Your connected account and API-key access decide what can be used in a live session.
Search by tool name, service, purpose, or input. Use the filters to narrow the list. Open a tool to read its full description and parameters.
Loading MCP tools…
FOR MCP DEVELOPERS
This section is only for developers building their own MCP client. Configure Streamable HTTP at https://<agent-host>/mcp/ and use Authorization: Bearer <your-api-key>. A compliant MCP SDK performs initialization, then uses tools/list to discover the tools allowed for that key. Codex already does this for you.
JSON-RPC reference:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {}
}Send this through an MCP client after it has completed its normal MCP initialization. Most MCP clients, including Codex, do this automatically and present the tools to you; application developers should use their MCP SDK rather than hand-crafting protocol traffic.
Each tool includes its name, a user-facing description, and an inputSchema. The schema is the exact parameter reference for that tool, including required fields, types, allowed values, and nested objects.
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [{
"name": "kiduna__example_tool",
"description": "What this tool does and when to use it.",
"inputSchema": {
"type": "object",
"properties": { "example_parameter": { "type": "string" } },
"required": ["example_parameter"]
}
}]
}
}Names can be namespaced when two connected services expose the same tool name. Do not hard-code tool names or parameter shapes from an old list: request the live list again when starting a session and use the schema returned with it.
Only call a name that appeared in your current tools/list response. Pass an object that validates against that tool’s inputSchema. The result format is tool-specific and is described by the tool’s own schema and response content.
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "kiduna__example_tool",
"arguments": { "example_parameter": "value" }
}
}CODEX PLUGIN
Add Kiduna as a Streamable HTTP MCP server. Codex then discovers only the tools that your Kiduna account may use.
In Kiduna Settings → Global API access, create your key and copy it once. Keep it out of source code and chat messages.
Set KIDUNA_API_KEY in the same local environment that starts Codex.
Open Codex Settings → Plugins / MCP servers, choose Add server, select Streamable HTTP, then use the endpoint and authentication below.
Restart the Codex extension or start a new Codex session so it loads the server and its current tool list.
Add this to ~/.codex/config.toml, or enter the same values in Codex’s MCP server form. Replace <agent-host> with your deployed Kiduna agent host. bearer_token_env_var reads the local secret and sends the exact header Kiduna requires: Authorization: Bearer <KIDUNA_API_KEY>.
[mcp_servers.kiduna] url = "https://<agent-host>/mcp/" bearer_token_env_var = "KIDUNA_API_KEY"
export KIDUNA_API_KEY='kiduna_ik_<your-secret>' # Codex sends this automatically to /mcp/: Authorization: Bearer kiduna_ik_<your-secret>
Start or restart Codex from that same terminal/session. Never commit this value to a repository or paste it into a prompt. A plain Authorization: <key> or an X-API-Key header will not authenticate to this MCP server.
List the tools available to me.
Show the DUNAs I can access.
List my connected services.
PLUGIN
Add the same Kiduna Streamable HTTP MCP server in Claude’s MCP connection settings.
In Kiduna Settings → Global API access, create a key and copy it once.
In Claude’s MCP connection settings, create a Streamable HTTP connection to https://<agent-host>/mcp/.
Use Authorization: Bearer kiduna_ik_<your-secret>. Store the secret with Claude’s secure connection settings; never put it in a prompt.
List the tools available to me.
Show the DUNAs I can access.
What connected services are available to me?
API KEYS
Create the global external-integration credential in Kiduna Settings. It can authenticate LLM chat, Skills reads, and MCP clients; it is not a DUNA-only key.
Sign in to Kiduna, open Settings → Global API access, then copy the new secret. The raw secret is shown once.
Pause all use of the key immediately, then enable the same key when you are ready.
Rotate the secret. Update your secret manager; the old value stops working immediately.
Permanently revoke the credential and create a replacement if you still need an integration.
REFERENCE
Two limits protect a Kiduna integration: the allowance on its API key and a rolling-minute allowance shared by the account.
WHAT COUNTS
Each chat request and Skills read.
The connection authentication and each chat message.
Tool discovery and each tool call.
The account guard is configured by the service between 1 and 120 requests per minute. It is shared across the account’s current API keys and all three interfaces, so creating another key does not create another account quota.
EXAMPLE
With the current default limits, this activity fills the allowance during one 60-second period:
The next authenticated request in that window receives 429. The allowance becomes available again as the minute window passes; it is not a daily quota or a billing charge.
HANDLE 429
When a response includes Retry-After, wait that many seconds. If it is absent, use a 60-second delay before retrying. Do not send a burst of automatic retries.
if (response.status === 429) {
const seconds = Number(response.headers.get("Retry-After") || 60);
await wait(seconds * 1000);
// Retry once only when the original operation is safe to retry.
}REFERENCE
Errors are concise by design: they help a client recover without revealing account or credential details.
Retry-After when present, otherwise wait 60 seconds. Retry once only when safe.{ "error": "invalid_request", "fields": [["body", "message"]] }WebSocket failures use an event instead: { "type": "error", "status": 422, "error": "invalid_request" }.
REFERENCE
The safest integration keeps API keys server-side and uses the narrowest interface required for the job.
Use a server environment variable or a secret manager. Never include a key in browser JavaScript.
Recreate the key immediately if it appears in a screenshot, chat, source code, or public repository.
Use HTTPS for HTTP requests and WSS for WebSocket connections.
Do not use answer-only chat to access tools, account data, or connected services.
REFERENCE
Public API errors intentionally avoid exposing account or credential details. Use the status code and the stable error field to decide what your client should do next.
WWW-Authenticate: Bearer.Retry-After when supplied. Otherwise wait 60 seconds and retry once only if the operation is safe to retry.HTTP: { "error": "invalid_request", "fields": [["body", "message"]] }
WebSocket: { "type": "error", "status": 422, "error": "invalid_request" }
MCP: tool-level error; inspect the current MCP tools and retry only when safe401 includes WWW-Authenticate: Bearer. A rate-limited response may include Retry-After.
LLM USAGE
Every answer has input tokens, output tokens, and a request. Together, they describe the LLM work performed for a chat call.
The instructions and message sent to the LLM.
The answer generated by the LLM.
Input tokens plus output tokens.
Completed answer-only chat calls.
HOW COST WORKS
The provider sets separate prices for input and output tokens. Output tokens are often priced differently from input tokens. If a product applies a multiplier, that is applied after the provider cost is calculated.
provider cost = (input tokens × input rate) + (output tokens × output rate)charged cost = provider cost × configured multiplierRates are normally expressed per one million tokens. The model and its current price determine the actual amount.
ILLUSTRATIVE EXAMPLE
This example explains the calculation only. It is not a live Kiduna price quote or an account charge.
A successful HTTP or WebSocket chat response contains the generated answer, its read-only mode, and a request_id. It does not currently include token counts, selected model, unit rates, provider cost, charged cost, balance, invoice, or billing status.
GOOD INTEGRATION PRACTICE
For each request, store the request_id, timestamp, endpoint, your application user or tenant, and any business context you need. Treat 429 as a rate-limit response, not a cost or usage value.
REFERENCE
The public integration service uses a rolling 60-second rate limit. It protects the service; it is not a billing quota and it does not measure token usage.
Each authenticated chat request and Skills read.
Authentication and every chat message sent after connection.
Tool discovery and every attempted tool call.
The authenticated account’s allowance is shared across its integration keys and all public interfaces. Creating a second key does not create a separate quota. A small process-level guard also protects against excessive traffic from one client address.
The next authenticated operation returns 429 with rate_limited. Honor Retry-After when it is present.
HTTP 429
Retry-After: 60
{ "detail": "rate_limited" }Do not retry every request immediately. Queue or shed work in your application.
Wait the response’s Retry-After value. If the header is absent, wait 60 seconds.
Retry only a safe operation. For chat, preserve the original idempotency key when retrying the same logical message.
429 as an error to hammer through.REFERENCE
Use the HTTP status, the stable error value, and the recovery action below. Error responses deliberately avoid exposing account, credential, or service internals.
response, mode: "read_only", and request_id; Skills returns a Skill or paginated Skill list.WWW-Authenticate: Bearer.Retry-After; otherwise wait 60 seconds and retry once only when safe.HTTP validation: { "error": "invalid_request", "fields": [["body", "message"]] }
HTTP failure: { "error": "external_answer_unavailable" }
WebSocket: { "type": "error", "status": 422, "error": "invalid_request" }
MCP: tool-level error in the MCP client protocolFor MCP, authentication failures, permission failures, unavailable tools, and execution problems arrive as MCP tool errors rather than an HTTP API response. Refresh tools/list, then call only a current tool with arguments that match its inputSchema.
GET STARTED
Follow this once, in order. At the end you will have a signed-in account, the access needed to chat, an API key, and a working request.
You need a Kiduna account, a place to keep a secret safely (an environment variable or secret manager), and the public agent-service URL for your Kiduna deployment. Do not put an API key in browser code, a Git repository, or a chat prompt.
Open Kiduna and choose Create an account. Complete the onboarding prompts until the app opens your Kiduna home.
Choose Sign in and use the same normal account. An integration/API key cannot be used to sign in to the app or to create another key.
Purchase 100 million KC to unlock Kiduna network membership while you hold it and receive 30 calendar days of free compute. An API key is free to create; a purchase does not change API-key scopes.
While signed in, open the Kiduna purchase screen. Enter the amount you want to spend in USDC. The service checks current availability and prepares a quote; do not treat a typed amount as a completed order.
If the app asks for a Kinship Code, enter it before creating the quote. The code is attached to the purchase and shown again in the review screen.
For card funding, the app opens a Stripe USDC-on-Solana funding step. Stripe supplies the available payment methods, identity checks, fees, and payment quote; USDC is sent to the displayed treasury destination. A wallet payment uses the connected wallet instead.
Confirm all of these fields: USDC you pay, KC you receive, Kinship Code, phase allocation, percentage available at DEX opening, cliff, linear vesting duration, and the fully vested month. The review also shows your membership stake after the purchase.
Before the payment button becomes available, acknowledge that KC is allocated and staked, is subject to vesting, and that no DEX opening date or market value is guaranteed. Continue to the payment provider or approve the wallet payment.
After payment, do not start a duplicate purchase. The app verifies payment, allocates and stakes KC, then shows completion. If a quote expires or a payment fails, start again and review the new quote; prices and availability can change.
While signed in, open Settings → Global API access and choose Create key.
Select chat.send for generic chat, agents.read and agents.chat for selected existing agents, and skills.read to read Skills. Choose MCP scopes only when your MCP integration needs them. For generic or selected-agent chat, leave DUNA restrictions off: restricted keys cannot use either chat interface.
Copy the value beginning kiduna_ik_ immediately. Store it as KIDUNA_API_KEY on your server. Treat it like a password; the app may not show the full secret again.
Set the two values below in your terminal. Replace the agent URL with the URL supplied for your deployment.
export KIDUNA_BASE_URL="https://<agent-host>"
export KIDUNA_API_KEY="kiduna_ik_…"
curl -X POST "$KIDUNA_BASE_URL/v1/chat" \
-H "Authorization: Bearer $KIDUNA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: first-chat-20261203-0001" \
-d '{"message":"Hello — what can you help me with?"}'A successful response contains a response string and a request_id. If you see 403, confirm the key has chat.send, is not restricted, and that public chat is enabled by your deployment administrator. See Errors for the exact recovery steps.
LLM API
Read the Skills owned by the account behind your API key. This API lists and retrieves Skills; it does not create, edit, approve, or run them.
GET /v1/skills?page=1&page_size=20
page starts at 1. page_size is optional and accepts 1–100. Send your integration key in the Bearer header.
curl "$KIDUNA_BASE_URL/v1/skills?page=1&page_size=20" \ -H "Authorization: Bearer $KIDUNA_API_KEY"
Expected 200 response:
{
"skills": [{
"id": "skill_01H...",
"name": "Daily summary",
"trigger_type": "cron",
"when_text": "Every weekday at 09:00",
"then_text": "Summarize my open work",
"tools": ["search_tasks"],
"skill_content": "…",
"status": "active",
"cron_expression": "0 9 * * 1-5",
"poll_interval_sec": null,
"requires_approval": false,
"realm_id": null,
"created_at": "2026-12-03T09:00:00Z",
"updated_at": "2026-12-03T09:00:00Z"
}],
"total": 1,
"page": 1,
"page_size": 20
}GET /v1/skills/{skill_id}. Use an id returned by the list request.
curl "$KIDUNA_BASE_URL/v1/skills/skill_01H..." \ -H "Authorization: Bearer $KIDUNA_API_KEY"
Expected 200 response: the single Skill object shown inside the skills array above, without the pagination fields.
cron or a polling trigger.active.null.null when none is assigned.Common results: 401 means the key is missing or invalid; 403 means it lacks skills.read; 404 means that Skill is not visible to this account; and 422 means the page values or Skill ID are invalid.
REFERENCE
Rate limiting protects the public API from bursts. It is separate from your chat-token balance, membership, and billing.
A newly created integration key is issued with a default limit of 30 authenticated requests per minute. This is the API request limit, not a “30 chats” limit: a chat request, Skills read, MCP discovery, and MCP tool call each count as one request. Your account shares this allowance across its public API keys.
Each authenticated chat request and Skills read.
Connection authentication and each chat message.
Tool discovery and each attempted tool call.
Your account’s requests are counted across its keys and public interfaces. Creating another key does not create a new allowance.
The service returns 429 with rate_limited. When the response includes Retry-After, wait exactly as instructed before trying again.
HTTP 429
Retry-After: <seconds>
{ "detail": "rate_limited" }Queue messages instead of retrying all of them at once.
Use Retry-After when it is present. If it is absent, use bounded exponential backoff.
Retry one request only. For the same chat action, reuse its original idempotency key so it cannot create a duplicate message.
REFERENCE
Start with the HTTP status, then use the response’s error value and the action below. Never log or share the API key that produced an error.
response and request_id. Skills returns one Skill or a paginated list.Retry-After when present; otherwise use bounded backoff and retry only when it is safe.Validation: { "error": "invalid_request", "fields": [["body", "message"]] }
Service error: { "error": "external_answer_unavailable" }
WebSocket: { "type": "error", "status": 422, "error": "invalid_request" }
MCP: an MCP protocol or tool-level errorFor MCP errors, refresh tools/list, then call a currently available tool with arguments that match its inputSchema.
API KEYS
Use this page after your key already exists: test it, recreate it safely, or stop it. For account and first-key setup, start with Quickstart.
New to Kiduna or creating a key for the first time? Quickstart covers account creation, sign-in, the full purchase flow, first-key setup, scopes, and your first chat request.
Set the key in a terminal that has access to your deployment’s agent-service URL. This read-only request confirms that the Bearer key is accepted before you connect your application.
export KIDUNA_BASE_URL="https://<agent-host>" export KIDUNA_API_KEY="kiduna_ik_…" curl "$KIDUNA_BASE_URL/v1/me" \ -H "Authorization: Bearer $KIDUNA_API_KEY"
A 200 response means the key is valid. A 401 means the key is missing, malformed, expired, disabled, recreated, or deleted. A 403 means the account or requested operation is not allowed.
Pause the key immediately when you suspect exposure or need a temporary stop.
Resume the same key after you confirm it is safe to use.
Create a replacement secret, update your secret manager, then use the new value. The old secret stops working immediately.
Permanently revoke a key that is no longer needed. This cannot be undone.
REFERENCE
Keep the account, payment flow, and integration key separate. A secure setup never exposes a reusable key to a browser, repository, log, or person who does not need it.
Store KIDUNA_API_KEY in a secret manager or server environment variable. Never place it in browser JavaScript, a mobile app bundle, client-side configuration, screenshots, tickets, or prompts.
Use Authorization: Bearer kiduna_ik_… over HTTPS, or authenticate a WebSocket without putting the key in its URL. URLs are commonly retained in browser history, proxy logs, and analytics.
Give a service only the permissions it needs: chat.send for generic chat, agents.read and agents.chat for selected agents, and skills.read for Skills. Do not add MCP or connected-tool scopes unless the integration requires them.
A key used for chat.send or agents.chat must not have DUNA restrictions. If a key is restricted, create a separate least-privilege key for that purpose instead of widening an existing service key.
Use the read-only key test on Create and manage keys from a controlled server environment. Do not paste the full secret into a support request to diagnose an error.
If a secret appears anywhere unsafe, recreate it immediately, update the server’s secret store, deploy the new value, and verify it. The old secret stops working, so coordinate the change with every service that uses it.
Disable the key while investigating suspicious use or pausing an integration. Enable it only after the incident is resolved.
Delete unused keys permanently. Also remove them from deployments, CI/CD variables, local .env files, and team password managers.
Redact the Authorization header, API key, payment-provider client secret, and any wallet/session tokens before saving request logs or error reports.
Generate one idempotency key per logical chat action. Reuse it only to safely retry the same request; do not reuse it for a different message.
Send only information needed for the task. Treat chat text, tool arguments, and external-service results as potentially sensitive operational data.
For MCP, read the current inputSchema from tools/list and validate data in your service before calling a tool. Do not trust tool names or arguments supplied by untrusted users.
Only make a purchase from the signed-in Kiduna flow. Before confirming payment, check the displayed USDC amount, KC allocation, Kinship Code, unlock and vesting terms, and the payment destination shown by the app. Stripe controls its own identity checks, payment methods, fee quote, and payment screen; do not share your API key with Stripe or use it as a payment credential.