Getting started
Installation
Add the Currai SDK to a TypeScript or Python app, and set the environment variables the client reads.
Currai ships first-party SDKs for TypeScript and Python. Both expose the same surface and emit the same wire format, so you can mix them across services and they land in the same backend.
TypeScript
Install the currai package:
npm install curraiThen import and construct the client:
import { Currai } from "currai";
const currai = new Currai({
publicKey: process.env.CURRAI_PUBLIC_KEY!,
secretKey: process.env.CURRAI_SECRET_KEY!,
});Python
Install the currai package:
pip install curraiThen construct the client:
import os
from currai import Currai
currai = Currai(
public_key=os.environ["CURRAI_PUBLIC_KEY"],
secret_key=os.environ["CURRAI_SECRET_KEY"]
)Environment variables
Both SDKs read the same credentials. Set these in your app's environment:
| Variable | Required | Description |
|---|---|---|
CURRAI_PUBLIC_KEY | yes | Public key, pk-lf-…. |
CURRAI_SECRET_KEY | yes | Secret key, sk-lf-…. |
CURRAI_BASE_URL | no | Currai instance URL (default https://www.currai.app). |
Verify the install
Before wiring Currai into a real request path, make sure the package imports and the client can be constructed in the runtime that will send traces.
TypeScript
import { Currai } from "currai";
const currai = new Currai({
publicKey: process.env.CURRAI_PUBLIC_KEY!,
secretKey: process.env.CURRAI_SECRET_KEY!,
});
await currai.flushAsync();Python
import os
from currai import Currai
currai = Currai(
public_key=os.environ["CURRAI_PUBLIC_KEY"],
secret_key=os.environ["CURRAI_SECRET_KEY"],
)
await currai.flush_async()If this fails before you send a trace, the problem is usually one of three things: the package is installed in a different environment than the app, the environment variables are not available to the server process, or the code is running in the browser instead of on the server.
Next, create those keys, then send your first trace.
