This directory contains demo projects that showcase how to use TetherAI providers in different environments.
A minimal chat application built with Next.js 14 App Router and Edge runtime.
-
Navigate to the example:
cd examples/nextjs -
Install dependencies:
pnpm install # or: npm install / yarn install -
Set your OpenAI API key in environment:
export OPENAI_API_KEY=sk-...Or create
.env.localfile with:OPENAI_API_KEY=sk-... -
Start the dev server:
pnpm dev
Open http://localhost:3000 in your browser.
A minimal backend-only example using a native Node.js HTTP server that streams responses via SSE.
-
Navigate to the example:
cd examples/node -
Install dependencies:
pnpm install
-
Set your OpenAI API key in environment:
export OPENAI_API_KEY=sk-... -
Start the server:
pnpm dev
The server listens on http://localhost:8787.
Send a chat request and watch the SSE stream:
curl -N -X POST http://localhost:8787/chat \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{ "role": "user", "content": "Say hi in 5 words." }]
}'You should see data: {...} chunks streaming back until {"done": true}.
- Streaming responses via Server-Sent Events (SSE)
withRetrymiddleware for transient errors (429, 5xx)withFallbackmiddleware (prepared for multiple providers)- Edge runtime compatible
Additional examples (Node.js, React hooks) will be added in future iterations.