Skip to main content

Examples

The examples/ workspace contains TypeScript projects that showcase common AccordKit setups. Each demo uses published packages, so you can copy the code into your own applications.

Repository layout

DirectoryWhat it shows
openai-examples/CLI runners covering chat completions (regular + streaming), Responses API, images, text-to-speech, transcription, and translation.
file-sink-demo/Minimal script that writes JSONL traces with the FileSink.
http-sink-demo/Sends buffered batches to an HTTP endpoint using HttpSink.
viewer-live-tail/Emits synthetic events over Server-Sent Events for testing the AccordKit Viewer’s live mode.

Running a demo

pnpm install
cd examples/openai-examples
pnpm start -- openai-chat-basic

Set OPENAI_API_KEY before running OpenAI demos. Logs are written to .accordkit-logs by default—inspect them with pnpm dlx @accordkit/viewer --input .accordkit-logs/*.jsonl.

Environment knobs:

  • ACCORDKIT_LOG_DIR — override the directory used by examples that rely on FileSink.
  • ACCORDKIT_API_KEY — optional API key forwarded by the HTTP sink demo.
  • ACCORDKIT_LIVE_PORT — port for the viewer-live-tail SSE server (defaults to 1967).

Use these demos as templates for wiring AccordKit into your own services.