DevelopersSDKs · CLI · REST

Write the call once. Route it from the console.

One API and one key for chat, embeddings, images, and audio. Models, fallback, and limits live in the route, so your code doesn't change when they do.

import { LatentKit } from "@latentkit/sdk";

const client = new LatentKit(); // reads LATENTKIT_API_KEY

const response = await client.chat.create({
  messages: [{ role: "user", content: "Say hello from LatentKit." }],
  response_profile: "balanced",
});

console.log(response.content);

Response 200 · X-LK-Request-ID: req_abc123

{
  "id": "req_abc123",
  "provider": "openai",
  "model": "gpt-4o-mini",
  "policy_version_id": "pol_v_xyz789",
  "content": "Hello from LatentKit!",
  "usage": { "input_tokens": 12, "output_tokens": 6 },
  "cost_usd": 0.0000054
}

The route chose the model. Your code didn't name one.

Quickstart

Three steps to a routed request.

  1. 1

    Get a key

    Guided setup connects a provider, builds and publishes a route, and issues your first key. It's shown once.

    Open the console
  2. 2

    Install

    • npm install @latentkit/sdk
    • pip install latentkit
    • composer require latentkit/latentkit-php
  3. 3

    Send, then look

    Send a request, then open Usage in the console: the request is there with its model, latency, and cost.

    Full quickstart

API

One API for every kind of model.

Requests carry the task, never the model. The key's route picks one that can handle it. Add purpose to ask for a job's models, or response_profile for speed or depth.

Chat

/v1/chat · /v1/complete

Streaming, tool calls, JSON output

Vision

/v1/vision

Images in, text out

Embeddings

/v1/embed · /v1/embeddings

Native and OpenAI-style response shapes

Images

/v1/image

Image generation

Speech

/v1/speech

Text to speech

Transcription

/v1/transcription · /v1/translation

Uploads or signed URLs, async jobs with webhooks

Video

/v1/video

Video generation

Queue

/v1/queue

Run requests asynchronously, retry-safe

Base URL https://ai.latentkit.com · REST reference · Routing by purpose

Errors

Errors you can act on.

Every response is JSON, even when infrastructure fails. Each error says what happened, whether a retry can help, and which request to look up.

  • request_id on every error, matching the request in your logs.
  • retryable tells you honestly whether trying again can work. Every 429 has Retry-After.
  • Idempotency-Key on transcription and queue requests, so a retry never bills twice.
Error handling
429 Too Many Requests · Retry-After: 2
{
  "error": {
    "code": "RATE_LIMITED",
    "category": "quota",
    "message": "Provider rate limit was hit.",
    "request_id": "req_91af",
    "retryable": true
  }
}

CLI

Your workspace, from the terminal.

Sign in through the browser, smoke-test a route, tail requests, rotate keys, and check your config in CI.

  • latentkit routes inspectSee a route's models and version
  • latentkit logs tailFollow requests as they arrive
  • latentkit keys rotateReplace a credential in place
  • latentkit config diffFail CI when the workspace drifts from your file
~/support-bot
$ npm install -g @latentkit/cli $ latentkit login ✓ Logged in (profile: default). $ latentkit chat "Say hello from LatentKit." --json { "provider": "anthropic", "model": "claude-sonnet-4-5", "content": "Hello!" } $ latentkit logs tail 14:02:11 support-bot claude-sonnet-4-5 200 412ms $0.0021 14:02:09 support-bot gpt-4.1-mini 200 850ms $0.0008

Get a key. Send a request.

Free with your own provider keys. No credit card.