# kinl.dev > kinl.dev is a unified inference API serving OpenAI, Anthropic, and Gemini > protocols through one base URL, one bearer key, and one prepaid balance. > Change `base_url` and the API key in any existing SDK or editor — zero new > client libraries required. Canonical location: https://kinl.dev/llms.txt ## Hosts & Quick Facts | Surface | Value | | --- | --- | | API Base URL (OpenAI) | `https://api.kinl.dev/v1` (`https://kinl.dev/v1` alias also works) | | API Origin (Anthropic / Gemini / MCP) | `https://api.kinl.dev` | | Auth headers | `Authorization: Bearer sk-kinl-...`, `x-api-key`, or `x-goog-api-key` | | Streaming | SSE on chat, responses, completions, `/v1/messages`, and Gemini `:streamGenerateContent?alt=sse` | | Pricing | Prepaid USD credit, billed in micro-dollars (`1000000` = $1). Failed/cancelled calls cost $0 | | Live catalogue (public) | `GET https://kinl.dev/api/models` (no key needed; live prices & capabilities) | | Rate limits | 300–900 req/min depending on plan (`GET https://kinl.dev/api/plans`) | | Documentation | https://docs.kinl.dev | | Tool Connectors (Copilot, Cursor, Cline, etc.) | https://connect.kinl.dev | | Dashboard | https://kinl.dev/dashboard | ## Quickstart (30 seconds) ### curl ```bash curl https://api.kinl.dev/v1/chat/completions \ -H "Authorization: Bearer $KINL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai-gpt-oss-20b", "messages": [{"role": "user", "content": "Explain vector embeddings in two sentences."}] }' ``` ### Python (OpenAI SDK) ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.kinl.dev/v1", api_key=os.environ["KINL_API_KEY"], ) reply = client.chat.completions.create( model="openai-gpt-oss-20b", messages=[{"role": "user", "content": "Explain vector embeddings in two sentences."}], ) print(reply.choices[0].message.content) ``` ### Node / TypeScript (OpenAI SDK) ```js import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.kinl.dev/v1", apiKey: process.env.KINL_API_KEY, }); const reply = await client.chat.completions.create({ model: "openai-gpt-oss-20b", messages: [{ role: "user", content: "Explain vector embeddings in two sentences." }], }); console.log(reply.choices[0].message.content); ``` ### Environment Variables (OpenAI-compatible tools) ```bash export OPENAI_BASE_URL="https://api.kinl.dev/v1" export OPENAI_API_KEY="sk-kinl-your-key" ``` ## Authentication Send your `sk-kinl-...` key as a header (never in a query string): - OpenAI & MCP: `Authorization: Bearer sk-kinl-...` - Anthropic SDKs & Claude Code: `x-api-key: sk-kinl-...` (or Bearer) - Gemini SDKs & Gemini CLI: `x-goog-api-key: sk-kinl-...` Rules: - Keys can be restricted to a model allowlist (`403 model_not_allowed` if a model is disallowed) and daily/monthly spend caps (`402 budget_exceeded`). - All keys spend from the account's shared prepaid balance; revoking a key takes effect immediately (`401`). - Public endpoints needing no key: `GET https://kinl.dev/api/models`, `GET https://kinl.dev/api/plans`, `GET https://kinl.dev/api/config`, `GET https://kinl.dev/health`. ## Endpoints Base URL `https://api.kinl.dev/v1` for OpenAI routes; `https://api.kinl.dev` for Anthropic, Gemini, and MCP: | Method | Path | Body | Returns | | --- | --- | --- | --- | | POST | `/v1/chat/completions` | JSON | Chat completion or SSE stream | | POST | `/v1/responses` | JSON | OpenAI Responses API output items or SSE stream | | POST | `/v1/completions` | JSON | Legacy text completion | | POST | `/v1/embeddings` | JSON | Vector embeddings | | GET | `/v1/models` | none | OpenAI or Anthropic model list (auth required) | | POST | `/v1/messages` | JSON | Native Anthropic Messages API (or SSE stream) | | POST | `/v1/messages/count_tokens` | JSON | Anthropic token estimate (free) | | POST | `/v1beta/models/{model}:generateContent` | JSON | Native Gemini response | | POST | `/v1beta/models/{model}:streamGenerateContent?alt=sse` | JSON | Streaming Gemini SSE (`?alt=sse` required) | | POST | `/v1beta/models/{model}:countTokens` | JSON | Gemini token estimate (free) | | GET | `/v1beta/models` | none | Gemini model listing | | POST | `/v1/images/generations` | JSON | Generated image URLs or base64 | | POST | `/v1/images/edits` | multipart | Edited image | | POST | `/v1/audio/speech` | JSON | Raw audio bytes (`audio/mpeg`, etc.) | | POST | `/v1/audio/transcriptions` | multipart | Transcript text | | POST | `/v1/video/generations` | JSON / multipart | Async video job (`202`) | | POST | `/v1/music/generations` | JSON | Async music job (`202`) | | GET | `/v1/:kind/generations/:id` | none | Job status (`:kind` = `video` or `music`) | | DELETE | `/v1/:kind/generations/:id` | none | Cancel job and release hold (free) | | GET | `/v1/media/artifacts/:jobId/:index` | none | Download finished media file | | POST | `/mcp` | JSON-RPC 2.0 | Read-only MCP server (Streamable HTTP) | ## Model Catalogue - `GET https://api.kinl.dev/v1/models` — OpenAI-format id listing (includes active `route/` virtual routes). Auth required. - `GET https://kinl.dev/api/models` — Public JSON catalogue with `category` (`chat`, `image`, `video`, `music`, `audio`, `embedding`), `contextLength`, `capabilities` (`streaming`, `tools`, `vision`, `reasoning`), and `pricing` in micro-dollars (`1000000` = $1). Non-token media units (`mediaPerUnitMicro` + `mediaUnit`): - `job`: per finished video or music job - `image`: per returned image (`n`) - `megapixel`: per megapixel of output `size` - `minute`: per minute of audio processed - `1K characters`: per 1,000 input characters (TTS) ### Reference chat models (check `/api/models` for live prices) | Model | Input ($/1M) | Output ($/1M) | Context | Capabilities | | --- | --- | --- | --- | --- | | `openai-gpt-oss-20b` | 0.000021 | 0.000103 | 128k | streaming, tools | | `openai-gpt-oss-120b` | 0.000080 | 0.000342 | 128k | streaming, tools | | `openai-gpt-oss-safeguard-20b` | 0.000086 | 0.000342 | 128k | streaming, tools | | `glm-4.5-air` | 0.000149 | 0.000969 | 128k | streaming, tools, reasoning | | `qwen3.8-omni-flash` | 0.000205 | 0.000642 | 1M | streaming, tools, vision, reasoning | | `deepseek-v4.1-flash` | 0.000206 | 0.001581 | 1M | streaming, tools, vision, reasoning | | `qwen-3-8-27b` | 0.000228 | 0.002847 | 262k | streaming, tools, vision, reasoning | | `glm-4.7-flash` | 0.000356 | 0.002346 | 198k | streaming, tools | | `minimax-m2.1` | 0.000410 | 0.001638 | 198k | streaming, tools, reasoning | ### Reference media & embedding models - Image (per image): `venice-flux-1.1-pro`, `seedream-4.5` - Image (per megapixel): `flux.2-klein-4b`, `flux.2-flex` - Image edit (multipart): `nano-banana-pro-edit`, `qwen-image-2-pro-edit` - Image (token-priced): `gemini-2.5-flash-image`, `gpt-5-image-mini` - Video: `grok-imagine-text-to-video`, `longcat-distilled-image-to-video` - Music: `venice-mmaudio-v2-text-to-audio` - Speech: `venice-kokoro-tts` - Embedding: `venice-embed-1` ## Streaming & Async Media - **Streaming:** Set `"stream": true`. Include `"stream_options": {"include_usage": true}` for final-chunk token counts. Cancelled or broken streams cost $0. - **Async media (`/video/generations`, `/music/generations`):** Returns `202` with `id`, `status` (`queued` → `running` → `succeeded` | `failed` | `cancelled` | `expired`), and `poll_after_ms` (typically `2000`). Poll `GET /v1/:kind/generations/:id`, then download `results[].url` from `https://api.kinl.dev` with your bearer key before expiry (`410 artifact_expired`). `DELETE` cancels for free. ## Pricing & Billing ``` charge = max( usage + per_request_fee , minimum_charge ) ``` | Plan | Monthly | Included Credit | Per Request | Minimum | | --- | --- | --- | --- | --- | | Pay as you go | $0 | $0 | $0.0005 | $0.0010 | | Starter | $19 | $19.90 | $0.0004 | $0.0008 | | Studio | $49 | $51.00 | $0.0003 | $0.0006 | | Scale | $149 | $156.00 | $0.0002 | $0.0004 | Read live plan numbers from `GET https://kinl.dev/api/plans`. An estimated hold is placed pre-flight and settled to exact micro-dollar usage on completion; failed or cancelled calls cost $0. ## Routing, Virtual Routes & BYOK ### Per-key routing modes - `exact` (default): run the exact requested model. - `family`: substitute cheapest fitting model in the same family (`X-Kinl-Routed: cheapest in family`). - `market`: substitute cheapest fitting model in the catalogue (`X-Kinl-Routed: cheapest in market`). When routed, headers report the actual served and billed model: ``` X-Kinl-Model: qwen3.8-omni-flash X-Kinl-Routed: cheapest in market ``` ### Virtual routes (`route/`) Configure in Dashboard → API keys → Virtual routes (or `/api/routes`) with 1–8 targets across catalogue models, BYOK pools, and marketplace offers: - Strategies: `fallback`, `weighted` (1–100), or `cheapest`. - Pre-first-byte failover on 429, 5xx, low balance, or TTFT timeout (`ttftTimeoutMs`: 100–120000 ms). - Response headers: `X-Kinl-Route`, `X-Kinl-Model`, `X-Kinl-Routed` (`route` or `route failover`). ### Your own keys (`byok//`) Add provider keys in Dashboard → API keys → Your provider keys (OpenAI, Anthropic, Gemini, Mistral, xAI, DeepSeek, Groq, OpenRouter, Together, Fireworks, or custom OpenAI-compatible): - Multi-key pools support `priority` (1–1000) and `weight` (1–100) with automatic cooldown failover on 429/5xx. - Cross-provider fallback header: `X-Kinl-Fallback: byok//, ...`. - Catalogue modes: `fallback` (default), `always`, or `manual`. - Works across OpenAI, Anthropic `/v1/messages`, and Gemini `/v1beta` routes ($0 kinl token charge). ## Caching, Telemetry & Webhooks - **Caching & coalescing:** Non-streaming embeddings and `temperature: 0` completions cache per account automatically, and concurrent identical bursts coalesce into 1 execution. Control with `X-Kinl-Cache: on | bypass | refresh` and `X-Kinl-Cache-TTL: `. Response headers: `X-Kinl-Cache: HIT | MISS | COALESCED | BYPASS`, `X-Kinl-Cache-Age`. `HIT` and `COALESCED` cost $0. - **Latency & cost tagging:** Responses include `X-Kinl-TTFT-Ms` and `X-Kinl-TPS`. Pass `X-Kinl-Tag` (max 64 chars; falls back to `metadata.tag`, `metadata.user_id`, or `user`) for Usage breakdowns and CSV export (`/api/requests/export`). Pass `X-Kinl-TTFT-Timeout-Ms` (100–120000) for pre-first-byte failover. - **Webhooks:** Up to 10 HTTPS endpoints via `/api/webhooks`. Signed with `X-Kinl-Signature: t=,v1=` (HMAC-SHA256 of `${t}.${rawBody}` using `whsec_...`). Events: `balance.low`, `cap.reached`, `byok.key_invalid`, `route.failover`, `webhook.test`. ## Errors & Limits OpenAI error envelope with additive `request_id`, `hint`, and (on 5xx) `report_url`: | Status | Code | Action | | --- | --- | --- | | 400 | `invalid_request` / `provider_key_missing` | Fix `param` or add BYOK key; do not retry unchanged | | 401 | `invalid_api_key` / `provider_key_rejected` | Fix or rotate key; do not retry | | 402 | `insufficient_credit` / `budget_exceeded` | Top up balance or raise cap | | 403 | `model_not_allowed` / `forbidden` / `marketplace_opt_in_required` | Check key allowlist or account settings | | 404 | `model_not_found` / `not_found` | Check `GET /v1/models` or path | | 409 | `conflict` | Duplicate in-flight `Idempotency-Key`; wait | | 410 | `artifact_expired` | Re-generate expired media artifact | | 413 | `payload_too_large` | Reduce body or use multipart upload | | 429 | `rate_limit_exceeded` | Respect `Retry-After`, retry with backoff | | 500/502/503/504 | `internal_error` / `capacity_unavailable` / `model_unavailable` / `model_timeout` | Retry with backoff (max 3 tries); $0 charged | - Rate-limit headers: `X-RateLimit-Limit`, `X-RateLimit-Reset`, `Retry-After`. - Idempotency: send `Idempotency-Key: ` on non-streaming POSTs (24h window). ## MCP Server Endpoint: `https://api.kinl.dev/mcp` (Streamable HTTP, `Authorization: Bearer sk-kinl-...`). Read-only tools: `list_models`, `get_model`, `estimate_cost`, `get_balance`, `get_usage`, `list_keys`. ```json { "mcpServers": { "kinl": { "type": "http", "url": "https://api.kinl.dev/mcp", "headers": { "Authorization": "Bearer sk-kinl-your-key" } } } } ``` ## Links - Dashboard: https://kinl.dev/dashboard - Models: https://kinl.dev/models - Pricing: https://kinl.dev/pricing - Docs: https://docs.kinl.dev - Connectors: https://connect.kinl.dev - Public catalogue JSON: https://kinl.dev/api/models - Live plans JSON: https://kinl.dev/api/plans - MCP endpoint: https://api.kinl.dev/mcp - Legal: https://kinl.dev/terms, https://kinl.dev/privacy, https://kinl.dev/cookies