Kaine API v1

Build with managed AI infrastructure. Programmatic access to landing pages, videos, leads, workflows.

Generate API Key →

Overview

The Kaine API exposes our managed infrastructure as a simple REST interface. Use it to:

Base URL: https://keine.tech/v1
Content 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:

HTTP 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.

⚠ Security: Never commit keys to git. Never expose them in client-side JavaScript. If a key leaks, revoke it immediately and rotate.

Your first call

Quick sanity check — no auth required:

curl — ping
curl https://keine.tech/v1/ping

Now with auth — confirm your key works:

curl — me
curl https://keine.tech/v1/me \
  -H "Authorization: Bearer kn_live_YOUR_KEY"

Errors

Errors are JSON with consistent shape:

Error response
{
  "detail": {
    "error": "invalid_api_key",
    "message": "API key not found or revoked.",
    "docs": "https://keine.tech/api-docs"
  }
}
StatusErrorWhen
400missing_fields / invalid_providerBad request body
401missing_api_key / invalid_api_key / revoked_api_keyAuth issue
403insufficient_scopeKey lacks required scope
429usage_cap_reachedHit monthly USD cap
500provider_error / generation_failedUpstream AI provider issue

Rate limits & cost caps

Two layers of protection:

TierMonthly capRate limit
Starter$5030 req/min
Pro$15060 req/min
Agency$400120 req/min
Developer$500120 req/min

Check your current status anytime via GET /v1/usage.

Endpoints

GET /v1/ping

Health check. No authentication required.

Response
{"ok": true, "version": "v1"}
GET /v1/me scope: read

Returns the account associated with your API key. Use this to verify auth works.

Response
{
  "user_id": 42,
  "username": "angel",
  "email": "angel@example.com",
  "scopes": ["read", "write"],
  "key_id": 1
}
GET /v1/usage scope: read

Returns your current 30-day usage window and remaining cap. Poll this to gracefully degrade before hitting the cap.

Response
{
  "status": {
    "tier": "developer",
    "cap_usd": 500.0,
    "used_usd": 42.18,
    "remaining_usd": 457.82,
    "percent": 8,
    "blocked": false
  }
}
GET /v1/leads scope: read

List leads for the authenticated account.

Query params: status (new / contacted / booked / complete), limit (default 50)

curl
curl "https://keine.tech/v1/leads?status=new&limit=10" \
  -H "Authorization: Bearer kn_live_YOUR_KEY"
POST /v1/landing-pages scope: write

Generate a new landing page from a brief. Costs ~$0.10-0.20 per page.

curl
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"
  }'
Response
{
  "ok": true,
  "url": "https://keine.tech/files/friesian-construction.html",
  "filename": "friesian-construction.html"
}
POST /v1/videos scope: write

Generate a video via Higgsfield / Runway / Kling / FAL. Pre-checks your usage cap.

FieldTypeDescription
promptstringWhat to generate (required)
image_urlstringOptional reference image
durationintegerSeconds, default 6
providerstringhiggsfield (default) / runway / kling / fal
curl
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"
  }'
GET /v1/workflows scope: read

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:

Use case: Your AI product hits Kaine's /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.
POST /v1/llm scope: write

Unified LLM call. Auto-routes to the cheapest capable provider with failover.

FieldTypeDescription
promptstringRequired — the user prompt
task_typestringOptional. Influences routing. Cheap-text tasks (caption, summarize, classify, follow_up, reply) → Gemini Flash. Anything else → Sonnet.
max_tokensintegerDefault 1024
temperaturefloatDefault 0.7
providerstring"auto" (default) | "google" | "anthropic". Auto picks cheapest.
curl
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
  }'
Response
{
  "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
}
GET /v1/audit scope: read

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
curl "https://keine.tech/v1/audit?endpoint=/v1/llm&limit=50" \
  -H "Authorization: Bearer kn_live_YOUR_KEY"
GET /v1/providers scope: read

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.

Use case: Your AI startup needs a "follow up with this lead" feature. Instead of building it yourself, call 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.
GET /v1/agents scope: read

Catalog of all 18 Kaine agents with descriptions, tools, and complexity tier. Discovery endpoint — call once at boot.

Response (truncated)
{
  "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
}
POST /v1/agents/run scope: write

Execute an agent on a goal. Agent plans → uses tools → self-critiques → returns result.

FieldTypeDescription
agent_namestringRequired. From GET /v1/agents catalog (e.g. "lead_crm_agent", "workflow_agent", "voice_phone_agent")
goalstringRequired. Plain-English description of what you want the agent to accomplish.
curl
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"
  }'
Response
{
  "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 — BYOK
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.

Want early access? Email hello@keine.tech and we'll add you to the Developer beta list.

Reference links