SDKs
Official TypeScript and Python SDKs are not published yet. Call the Platform API directly with your organization API key (Authorization: Bearer ck_…).
TypeScript
const res = await fetch("https://api.example.com/v1/threads", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ title: "Launch planning" }),
});
const { data: thread } = await res.json();
const messageRes = await fetch(`https://api.example.com/v1/threads/${thread.id}/messages`, {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ role: "user", content: "Create a launch plan from this brief" }),
});
const { data: message, run } = (await messageRes.json()).data;
// Stream run events with SSE: GET /v1/threads/:id/runs/:runId/eventsPython
import httpx
headers = {"Authorization": f"Bearer {api_key}"}
thread = httpx.post(
"https://api.example.com/v1/threads",
headers=headers,
json={"title": "Launch planning"},
).json()["data"]
payload = httpx.post(
f"https://api.example.com/v1/threads/{thread['id']}/messages",
headers=headers,
json={"role": "user", "content": "Create a launch plan from this brief"},
).json()["data"]
run_id = payload["run"]["id"]
# Poll or stream: GET /v1/threads/{thread['id']}/runs/{run_id}/events