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);
from latentkit import LatentKit
with LatentKit() as client: # reads LATENTKIT_API_KEY
response = client.chat.create(
messages=[{"role": "user", "content": "Say hello from LatentKit."}],
response_profile="balanced",
)
print(response["content"])
use LatentKit\LatentKit;
$client = new LatentKit(); // reads LATENTKIT_API_KEY
$response = $client->chat->create(
messages: [['role' => 'user', 'content' => 'Say hello from LatentKit.']],
responseProfile: 'balanced',
);
echo $response['content'];
curl https://ai.latentkit.com/v1/chat \
-H "Authorization: Bearer $LATENTKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [{ "role": "user", "content": "Say hello from LatentKit." }],
"response_profile": "balanced"
}'
npm install -g @latentkit/cli
latentkit login # browser sign-in, no key to paste
latentkit chat "Say hello from LatentKit." --json
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
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
Install
npm install @latentkit/sdkpip install latentkitcomposer require latentkit/latentkit-php
-
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
SDKs and integrations
Official clients for your stack.
The SDKs read LATENTKIT_API_KEY, return the same response shape, and put the request ID on every error.
@latentkit/sdk
Streaming, tools, structured output, cancellation
PythonPyPI · 0.2.1
latentkit
Sync and async clients, streaming
PHPBeta · 0.1.0-beta.3
latentkit/latentkit-php
PHP 8.1+, cURL or PSR-18
CLInpm · 0.1.0
@latentkit/cli
Login, smoke tests, logs, keys, CI checks
Vercel AI SDKAlpha · 0.1.0-alpha.3
@latentkit/ai-sdk-provider
Text, streaming, tools, structured output
LaravelAlpha · 0.1.0-alpha.1
latentkit/laravel
Facade, config, artisan check
WordPressIn review
LatentKit AI Provider
Submitted to the WordPress.org directory
DrupalReview branch
latentkit_ai
Public 1.0.x branch, no release yet
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/completeStreaming, tool calls, JSON output
Vision
/v1/visionImages in, text out
Embeddings
/v1/embed · /v1/embeddingsNative and OpenAI-style response shapes
Images
/v1/imageImage generation
Speech
/v1/speechText to speech
Transcription
/v1/transcription · /v1/translationUploads or signed URLs, async jobs with webhooks
Video
/v1/videoVideo generation
Queue
/v1/queueRun 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": {
"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 versionlatentkit logs tailFollow requests as they arrivelatentkit keys rotateReplace a credential in placelatentkit config diffFail CI when the workspace drifts from your file
Get a key. Send a request.
Free with your own provider keys. No credit card.