HTTP, cURL and PowerShell
Make requests without an SDK and inspect response bodies and status codes.
Choose the endpoint
| Task | POST path | Request / response |
|---|---|---|
| Chat | /v1/chat/completions | messages / choices[0].message.content |
| Responses client | /v1/responses | input / text blocks in output |
| Anthropic client | /v1/messages | messages and max_tokens / content blocks |
| Image generation | /api/v1/images/generations | prompt / private image metadata |
| Kendr surfaces | /api/v1/query | See the query guide. |
Use https://api.kendr.org as the HTTP origin. A server key needs models:invoke for model calls and models:read for authenticated discovery.
cURL with a JSON file
Save this as request.json:
{
"model": "kendr-intelligent",
"messages": [{"role": "user", "content": "Explain API keys in two sentences."}]
}
After setting KENDR_API_KEY, run in Bash or zsh. Use a unique request ID for each new operation and preserve it with the unchanged body for retries.
export KENDR_REQUEST_ID="demo-chat-001" curl --fail-with-body --show-error --max-time 180 \ https://api.kendr.org/v1/chat/completions \ -H "Authorization: Bearer $KENDR_API_KEY" \ -H "Idempotency-Key: $KENDR_REQUEST_ID" \ -H "Content-Type: application/json" \ --data-binary @request.json
PowerShell
Use Invoke-RestMethod to avoid differences between Windows curl aliases and curl.exe.
$env:KENDR_REQUEST_ID = "demo-chat-002"
$headers = @{
Authorization = "Bearer $env:KENDR_API_KEY"
"Idempotency-Key" = $env:KENDR_REQUEST_ID
}
$body = @{
model = "kendr-intelligent"
messages = @(@{ role = "user"; content = "Explain API keys in two sentences." })
} | ConvertTo-Json -Depth 10
$result = Invoke-RestMethod -Method Post `
-Uri "https://api.kendr.org/v1/chat/completions" `
-Headers $headers -ContentType "application/json" -Body $body -TimeoutSec 180
$result.choices[0].message.content
Server-side JavaScript fetch
Save as request.mjs and run with Node.js with built-in fetch. Set KENDR_API_KEY and a unique KENDR_REQUEST_ID first.
const response = await fetch("https://api.kendr.org/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KENDR_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": process.env.KENDR_REQUEST_ID,
},
body: JSON.stringify({ model: "kendr-intelligent",
messages: [{ role: "user", content: "Explain API keys in two sentences." }] }),
signal: AbortSignal.timeout(180_000),
});
if (!response.ok) throw new Error(`Kendr returned HTTP ${response.status}`);
const result = await response.json();
if (result.choices?.[0]?.finish_reason !== "stop") throw new Error("Incomplete answer");
console.log(result.choices[0].message.content);
Diagnose a failed call
Check the status before parsing a success shape. 400 indicates validation, 401/403 credentials or scopes, 402 insufficient credits, and 429 traffic limits. An ambiguous timeout needs recovery with the original request ID. Keep keys on your server.