Reference
API reference
The public HTTP endpoints, authentication, ingestion event types, prompt management, and SDK client options.
Currai exposes a small public HTTP surface. The SDKs wrap it for you, but you can call it directly from any language.
Endpoints
| Endpoint | Method | Auth | Body |
|---|---|---|---|
/api/public/ingestion | POST | HTTP Basic | { batch: IngestionEvent[] } |
/api/public/otel/v1/traces | POST | HTTP Basic or Bearer | OTLP protobuf or JSON |
/api/public/prompts | GET | HTTP Basic | — (query: name, version?, label?, type?) |
/api/public/prompts | POST | HTTP Basic | { name, type?, prompt, config?, tags?, labels?, commitMessage? } |
/api/public/health | GET | none | — |
All paths are relative to your baseUrl (default https://www.currai.app).
Authentication
Ingestion uses HTTP Basic auth — public key as the username, secret key as the password:
Authorization: Basic base64(publicKey:secretKey)The OTLP endpoint also accepts a Bearer secret key. See Authentication for how to create keys.
Ingestion
POST /api/public/ingestion accepts a batch of events:
{
"batch": [
/* IngestionEvent objects */
]
}Each event has a type. The supported types are:
| Type | Creates / updates |
|---|---|
trace-create | a trace |
span-create | a span observation |
span-update | patches an existing span |
generation-create | a generation observation |
generation-update | patches an existing generation |
event-create | a point-in-time event |
The server responds with HTTP 207 and a per-event result:
{
"successes": [
/* … */
],
"errors": [
/* … */
]
}This is the same wire format the Langfuse SDKs emit, so a Langfuse client pointed at Currai's baseUrl works unchanged.
Levels
Traces and observations carry a level: one of DEBUG, DEFAULT, WARNING, or ERROR.
SDK client options
TypeScript
| Option | Default | Description |
|---|---|---|
publicKey | (required) | Public key (pk-lf-…). |
secretKey | (required) | Secret key (sk-lf-…). |
baseUrl | https://www.currai.app | Currai instance URL. |
enabled | true | When false, no events are buffered or sent. |
flushAt | 15 | Auto-flush when the buffer reaches this many events. |
flushInterval | 10000 | Background flush interval (ms). 0 disables it. |
requestTimeout | 10000 | Per-request timeout (ms). |
onError | console.warn | Sink for network / ingestion errors. |
fetch | globalThis.fetch | Override for testing or non-standard runtimes. |
Python
| Option | Default | Description |
|---|---|---|
public_key | (required) | Public key (pk-lf-…). |
secret_key | (required) | Secret key (sk-lf-…). |
base_url | https://www.currai.app | Currai instance URL. |
enabled | True | When False, no events are buffered or sent. |
flush_at | 15 | Auto-flush when the buffer reaches this many events. |
flush_interval_ms | 10000 | Background flush interval (ms). 0 disables it. |
request_timeout_ms | 10000 | Per-request timeout (ms). |
on_error | logging.warning | Sink for network / ingestion errors. |
Client methods
The constructed client exposes the same surface in both languages — only the casing differs (camelCase in TypeScript, snake_case in Python).
| TypeScript | Python | Returns | Description |
|---|---|---|---|
trace(options?) | trace(**kwargs) | CurraiTrace | Start a trace. Synchronous — buffers a trace-create event. |
getPrompt(name, opts?) | get_prompt(name, …) | CurraiPrompt | async — fetch a managed prompt (resolves A/B / production). |
createPrompt(body) | create_prompt(body) | CurraiPrompt | async — create a new version of a managed prompt. |
flushAsync() | flush_async() | void | async — flush the buffer; await before a process exits. |
| — | flush() | None | Python only — synchronous flush for non-async call sites. |
shutdownAsync() | shutdown_async() | void | async — flush and stop the background flusher. |
| — | shutdown() | None | Python only — synchronous shutdown. |
getPrompt/get_prompt take an options object (version?, label?, type?) to pin a specific version, label, or prompt type; with none, the server resolves an active A/B experiment, then the production label, then the latest version.
