Quickstart
Create an account, choose CLI, SDK, or REST, and send your first routed request.
Get from zero to a working /v1/chat request in a few minutes.
1. Create an account
Sign up at console.latentkit.com. A new workspace opens a short guided setup: pick an AI provider, connect it with Platform Access or your own key, choose models, confirm your first route, and create an API key. You can skip it and finish later from Finish setup in the sidebar.
2. Choose how you want to connect
Use the path that matches what you are doing:
| Path | Best for | Credential |
|---|---|---|
| CLI | Humans testing from a terminal, support, debugging, logs, traces, and CI checks | Browser login token or LATENTKIT_API_KEY |
| JavaScript SDK | Node.js, Next.js, Express, serverless, background jobs | LATENTKIT_API_KEY |
| Python SDK | FastAPI, Django, Flask, scripts, workers | LATENTKIT_API_KEY |
| PHP SDK (beta) | WordPress, Drupal, Laravel, PHP workers and scripts | LATENTKIT_API_KEY |
| REST / cURL | Any language, quick tests, AI agents, low-level debugging | LATENTKIT_API_KEY |
3. Copy an API key for app code
Copy your key when guided setup (or API Keys) creates it — it is shown once, and the console masks existing secrets. Store it in a server-side environment variable:
export LATENTKIT_API_KEY="lk-..."Never commit API keys or expose them in browser bundles.
If you only want to test from your terminal, you can start with latentkit login instead of copying a raw API key. The CLI opens a browser approval flow and stores a local account profile. App code and CI should still use LATENTKIT_API_KEY.
4. Send a chat request
npm install -g @latentkit/cli
latentkit login
latentkit whoami
latentkit chat "Say hello from LatentKit."Use JSON when another program or AI agent needs to read the result:
latentkit chat "Say hello from LatentKit." --jsonnpm install @latentkit/sdkimport { LatentKit } from '@latentkit/sdk';
const client = new LatentKit();
const response = await client.chat.create({
messages: [{ role: 'user', content: 'Say hello from LatentKit.' }],
response_profile: 'balanced',
max_tokens: 100,
});
console.log(response.content);pip install latentkitimport os
from latentkit import LatentKit
with LatentKit(api_key=os.environ["LATENTKIT_API_KEY"]) as client:
response = client.chat.create(
messages=[{"role": "user", "content": "Say hello from LatentKit."}],
response_profile="balanced",
max_tokens=100,
)
print(response["content"])composer require latentkit/latentkit-php:0.1.0-beta.3<?php
require __DIR__ . '/vendor/autoload.php';
use LatentKit\LatentKit;
$client = new LatentKit();
$response = $client->chat->create(
messages: [['role' => 'user', 'content' => 'Say hello from LatentKit.']],
responseProfile: 'balanced',
maxTokens: 100,
);
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",
"max_tokens": 100
}'5. Understand the response
A successful response looks like this:
{
"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, "total_tokens": 18 },
"cost_usd": 0.0000054
}content is the assistant's answer; provider and model report which route attempt executed. If something fails, read X-LK-Request-ID from response headers and the JSON error field — see Error handling.
Request fails with NO_HEALTHY_PROVIDER? Your key needs an assigned published route with at least one eligible model. Guided setup creates and assigns one for you; otherwise check Routes and AI Providers in the console. See Troubleshooting.
Route-based requests
Do not send model, provider, route, or policy in application requests. Change provider/model selection by editing the API key's assigned route in the console.
Optional response depth
Pass response_profile to prefer speed or depth when the route allows overrides:
| Value | Use when |
|---|---|
fast | Lower latency, lower token use |
balanced | Default quality and speed |
deep | More reasoning depth when supported |
Next steps
- Authentication
- Core concepts — how routing, keys, and capabilities fit together
- CLI, JavaScript SDK, Python SDK, or PHP SDK
- Streaming, Tool calling, and the other API reference pages
- Vibe coding setup — copy a stack-aware prompt for Cursor, Claude, or other AI tools