Overview
The Kaine API exposes our managed infrastructure as a simple REST interface. Use it to:
- Generate AI landing pages from a natural-language brief
- Produce video ads via Higgsfield, Runway, Kling, or FAL
- List and manage leads / workflows / generated assets
- Check your current usage and remaining cap programmatically
https://keine.tech/v1Content type: All POST bodies are JSON. All responses are JSON.
API version: v1 (stable contract — breaking changes go to /v2)
Authentication
Every request needs an API key in the Authorization header:
Authorization: Bearer kn_live_abc123xyz...
API keys are scoped (read, write) and tied to a user account. Generate, list, or revoke keys via the Kaine dashboard's Developer settings page. We never show a key twice — copy and save it on creation.
Your first call
Quick sanity check — no auth required:
curl https://keine.tech/v1/ping
Now with auth — confirm your key works:
curl https://keine.tech/v1/me \
-H "Authorization: Bearer kn_live_YOUR_KEY"
Errors
Errors are JSON with consistent shape:
{
"detail": {
"error": "invalid_api_key",
"message": "API key not found or revoked.",
"docs": "https://keine.tech/api-docs"
}
}
| Status | Error | When |
|---|---|---|
| 400 | missing_fields / invalid_provider | Bad request body |
| 401 | missing_api_key / invalid_api_key / revoked_api_key | Auth issue |
| 403 | insufficient_scope | Key lacks required scope |
| 429 | usage_cap_reached | Hit monthly USD cap |
| 500 | provider_error / generation_failed | Upstream AI provider issue |
Rate limits & cost caps
Two layers of protection:
- Per-key rate limits: 60 req/min default. Burst-tolerant.
- Per-account cost cap: hard USD cap per 30-day rolling window. Once you hit it, calls return
429 usage_cap_reacheduntil the window refreshes or you upgrade.
| Tier | Monthly cap | Rate limit |
|---|---|---|
| Starter | $50 | 30 req/min |
| Pro | $150 | 60 req/min |
| Agency | $400 | 120 req/min |
| Developer | $500 | 120 req/min |
Check your current status anytime via GET /v1/usage.
Endpoints
Health check. No authentication required.
{"ok": true, "version": "v1"}
Returns the account associated with your API key. Use this to verify auth works.
{
"user_id": 42,
"username": "angel",
"email": "angel@example.com",
"scopes": ["read", "write"],
"key_id": 1
}
Returns your current 30-day usage window and remaining cap. Poll this to gracefully degrade before hitting the cap.
{
"status": {
"tier": "developer",
"cap_usd": 500.0,
"used_usd": 42.18,
"remaining_usd": 457.82,
"percent": 8,
"blocked": false
}
}
List leads for the authenticated account.
Query params: status (new / contacted / booked / complete), limit (default 50)
curl "https://keine.tech/v1/leads?status=new&limit=10" \
-H "Authorization: Bearer kn_live_YOUR_KEY"
Generate a new landing page from a brief. Costs ~$0.10-0.20 per page.
curl -X POST https://keine.tech/v1/landing-pages \
-H "Authorization: Bearer kn_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"business_name": "Friesian Construction",
"client_email": "info@friesian.com",
"industry": "construction",
"tone": "Professional",
"description": "Family-owned commercial construction in Salinas, CA"
}'
{
"ok": true,
"url": "https://keine.tech/files/friesian-construction.html",
"filename": "friesian-construction.html"
}
Generate a video via Higgsfield / Runway / Kling / FAL. Pre-checks your usage cap.
| Field | Type | Description |
|---|---|---|
| prompt | string | What to generate (required) |
| image_url | string | Optional reference image |
| duration | integer | Seconds, default 6 |
| provider | string | higgsfield (default) / runway / kling / fal |
curl -X POST https://keine.tech/v1/videos \
-H "Authorization: Bearer kn_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Aerial drone shot of a coastal city at golden hour",
"duration": 8,
"provider": "higgsfield"
}'
List workflow runs (n8n + Kaine native).
🚪 Gateway (Layer 3) — for AI startups
The Gateway endpoints expose Kaine's infrastructure layer to other AI products. If you're building an agent platform and don't want to wire your own multi-provider routing, cost caps, and audit log — drop in /v1/llm instead of calling Anthropic / OpenAI / Google directly. We handle:
- Multi-provider routing — cheapest capable model per task
- Auto-failover — if Claude is down, retry GPT or Gemini transparently
- Cost caps — pre-checks your usage cap before every call
- Audit log — every call recorded with cost + timestamp (compliance gold)
/v1/llm with a prompt. Kaine routes it to the right model, charges your account, returns the response. Your users never see API keys. You stop maintaining 5 SDK integrations.
Unified LLM call. Auto-routes to the cheapest capable provider with failover.
| Field | Type | Description |
|---|---|---|
| prompt | string | Required — the user prompt |
| task_type | string | Optional. Influences routing. Cheap-text tasks (caption, summarize, classify, follow_up, reply) → Gemini Flash. Anything else → Sonnet. |
| max_tokens | integer | Default 1024 |
| temperature | float | Default 0.7 |
| provider | string | "auto" (default) | "google" | "anthropic". Auto picks cheapest. |
curl -X POST https://keine.tech/v1/llm \
-H "Authorization: Bearer kn_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Write a 1-line product description for an AI scheduler",
"task_type": "short_copy",
"max_tokens": 80
}'
{
"ok": true,
"text": "AI that books your meetings before you finish your coffee.",
"provider": "google",
"model": "gemini-flash",
"tokens_in": 18,
"tokens_out": 14,
"cost_usd": 0.000005
}
Audit log of every API call made by your account. Use for billing reconciliation, compliance reports, or debugging which key is making which calls.
Query params: limit (default 100, max 500), endpoint (filter to specific path, e.g. /v1/llm)
curl "https://keine.tech/v1/audit?endpoint=/v1/llm&limit=50" \
-H "Authorization: Bearer kn_live_YOUR_KEY"
Tells you which LLM providers are available + how auto-routing will pick between them. Useful to debug why a call routed to provider X instead of Y.
🤖 Agents-as-a-Service
Kaine has 18 specialist AI agents (Lead CRM, Meta Ads, Voice/Phone, Workflow Builder, Knowledge Librarian, etc). The endpoints below let you invoke ANY of them via API — pay-per-run, no need to write your own agent loop.
POST /v1/agents/run with agent_name: "lead_crm_agent" and a goal. Kaine's agent plans, picks tools, executes, returns the result. You sell the outcome to your customer.
Catalog of all 18 Kaine agents with descriptions, tools, and complexity tier. Discovery endpoint — call once at boot.
{
"agents": [
{
"name": "lead_crm_agent",
"description": "Automatically follows up with new leads via email and SMS until they book",
"allowed_tools": ["crm_update", "send_email", "send_sms", "send_booking_link"],
"complexity_tier": "standard",
"use_extended_thinking": false
},
// + 17 more
],
"count": 18
}
Execute an agent on a goal. Agent plans → uses tools → self-critiques → returns result.
| Field | Type | Description |
|---|---|---|
| agent_name | string | Required. From GET /v1/agents catalog (e.g. "lead_crm_agent", "workflow_agent", "voice_phone_agent") |
| goal | string | Required. Plain-English description of what you want the agent to accomplish. |
curl -X POST https://keine.tech/v1/agents/run \
-H "Authorization: Bearer kn_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_name": "lead_hunter_agent",
"goal": "Find 5 roofing companies in Tampa that need marketing help"
}'
{
"ok": true,
"agent_name": "lead_hunter_agent",
"run_id": 8421,
"status": "completed",
"summary": "Found 5 prospects, scored, top 3 added to CRM...",
"steps": 6
}
Typical cost: $0.05-0.30 per standard agent run, $0.20-1.00 per complex agent (workflow, voice/phone).
🔑 BYOK (Bring Your Own Keys)
For high-volume customers: send your own Anthropic key in the byo_key field on POST /v1/llm. Your provider account gets charged directly; Kaine charges a flat $0.0005 per call platform fee instead of marking up provider costs.
curl -X POST https://keine.tech/v1/llm \
-H "Authorization: Bearer kn_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Write a haiku",
"byo_key": "sk-ant-...",
"byo_provider": "anthropic"
}'
Your key never gets stored — it's used once for the call and discarded. Audit log records the call (with cost=$0.0005 platform fee) but never the key.
SDKs (coming soon)
Official SDKs in development for Python, Node.js, and Go. For now, every standard HTTP client works — curl, fetch, requests, axios.
Reference links
- Raw OpenAPI 3.1 spec — feed this into Postman / Insomnia / generators
- Interactive Swagger UI — try endpoints live in the browser
- ← Back to keine.tech