ThinkFeel Documentation

Cookbooks | Last Synced: February 25, 2026

Cookbook Collection

Practical build guides for ThinkFeel integrations.

This page mirrors the latest cookbook content from the Artificial Affect GitHub org (local snapshot from curve-labs-cookbooks). It focuses on implementation recipes for fast starts with clear caveats for production hardening.

Repository Snapshot

Source reference used for this page: latest local mirror of curve-labs-cookbooks.

FieldValue
Organizationartificial-affect
Repositorycurve-labs-cookbooks
Latest Commitfe2924c
Commit DateFebruary 25, 2026
Summaryadd sdk ui, chat bootstrap, backend

Clone and inspect

git clone https://github.com/artificial-affect/curve-labs-cookbooks.git
cd curve-labs-cookbooks
git log -1 --oneline

Available Cookbooks

The repository currently includes two recipe tracks: a root SDK runner and a Next.js chat cookbook.

Cookbook 01

Root SDK Runner

Plain Node.js scripts for local wiring checks with environment-driven configuration.

  • Fast local request validation against ThinkFeel endpoints
  • Minimal setup for SDK smoke testing
  • Offline tests for root orchestration/config helpers

Cookbook 02

Next.js Chat Cookbook

Accessible multi-turn chat and quickstart API routes using Vercel AI SDK with ThinkFeel-compatible non-stream responses.

  • Quickstart route: POST /api/quickstart
  • Chat route: POST /api/chat
  • Schema validation plus normalized error envelopes

Root SDK Runner

Use this recipe when you want a minimal local runner without UI scaffolding.

Environment variables

export CURVE_API_KEY=your_thinkfeel_api_key
export CURVE_PERSONA_ID=your_persona_uuid

# Optional
export CURVE_PROMPT="hey what's up?"
export THINKFEEL_BASE_URL="https://playground.curvelabs.org/api/v1"

Install and run

npm install
npm start

# Offline tests
npm test

Intended Scope

The root runner is explicitly for local SDK wiring and checks. It is not a deployed service and does not include user authentication, tenancy isolation, or abuse controls by default.

Next.js Cookbook

Full-stack example with quickstart + multi-turn chat pages, wired to ThinkFeel via an OpenAI-compatible provider base URL.

Local setup

cp .env.example .env.local
npm install
npm run dev

.env.local

CURVE_API_KEY=your_thinkfeel_api_key
CURVE_PERSONA_ID=your_persona_uuid
# Optional
THINKFEEL_BASE_URL=https://playground.curvelabs.org/api/v1

Included Routes

  • GET /: quickstart UI
  • GET /chat: multi-turn chat UI
  • POST /api/quickstart: completion sample
  • POST /api/chat: non-stream chat exchange

Key Notes

  • • Uses Vercel AI SDK provider plumbing with ThinkFeel base URL override
  • • ThinkFeel completions are non-stream; UI expects full reply payloads
  • • Tool-calling and some OpenAI parameters remain unsupported
  • • Error payloads are normalized as validation/config/provider envelopes

API Contracts

POST /api/quickstart

Request

{
  "prompt": "hello",
  "personaId": "optional-uuid"
}

Response

{
  "text": "...",
  "model": "persona-uuid"
}
POST /api/chat

Request

{
  "messages": [{ "role": "user", "content": "hello" }],
  "personaId": "optional-uuid"
}

Response

{
  "reply": "...",
  "model": "persona-uuid"
}
Shared Error Envelope
{
  "error": {
    "type": "validation | config | provider",
    "message": "..."
  }
}

Production Hardening

Both cookbook READMEs clearly state these examples are starter references, not production-ready defaults.

Required Before Public Exposure

  • Authenticate and authorize every API route with user/tenant checks
  • Apply edge + app rate limiting, throttling, and abuse controls
  • Review CORS/CSRF policies and enforce strict request limits
  • Set up structured logs, error reporting, and alerting for provider failures
  • Store and rotate API keys in managed secret stores
  • Enforce retention, deletion, and sensitive-data sanitization policies
  • Define reliability and cost safeguards (budgets, retries, circuit breakers)

Testing + Migration

Use the shipped scripts first, then move to live tests only after env configuration is confirmed.

Next.js cookbook scripts

npm run dev
npm run test
npm run typecheck
npm run build

# Optional live smoke test
npm run test:live

Chat SDK Adaptation Summary

  • Replace streaming flow with non-stream completion calls for ThinkFeel
  • Use persona UUID as the completion model identifier
  • Send full multi-turn message history on each request
  • Do not assume token streaming in client transport/UI state