Integrate SDKs, export usage data, review suggestions, and explore experimental routing/cache endpoints.
Python
pip install costpilot import costpilot costpilot.init(api_key="cp_xxx")
Node.js
npm install costpilot
import { init } from 'costpilot';
init({ apiKey: 'cp_xxx' });/api/v1/eventsTrack Events
curl -X POST "$BASE/api/v1/events" \
-H "Authorization: Bearer cp_xxx" \
-H "Content-Type: application/json" \
-d '{"provider":"openai","model":"gpt-4o","prompt_tokens":1200,"completion_tokens":400}'/api/v1/export?format=csv&from=2026-03-01T00:00:00ZExport Logs (CSV)
curl -H "Authorization: Bearer cp_xxx" \ "$BASE/api/v1/export?format=csv&include_content=true" -o events.csv
/api/v1/suggestionsSuggestions
POST is accepted as a backwards-compatible alias.
curl -H "Authorization: Bearer cp_xxx" \ "$BASE/api/v1/suggestions"
/api/v1/route-modelRoute Model
Experimental routing guidance; validate recommendations before production use.
curl -X POST "$BASE/api/v1/route-model" \
-H "Authorization: Bearer cp_xxx" \
-H "Content-Type: application/json" \
-d '{"objective":"balanced","estimatedPromptTokens":1200,"estimatedCompletionTokens":400}'/api/v1/proxyProxy (Cache + Routing)
Experimental helper response; this endpoint does not call the upstream provider for you.
curl -X POST "$BASE/api/v1/proxy" \
-H "Authorization: Bearer cp_xxx" \
-H "Content-Type: application/json" \
-d '{"provider":"openai","model":"gpt-4o","prompt":"Summarize this...","objective":"cost"}'/api/v1/cache?provider=openai&model=gpt-4o&prompt=HelloCache Lookup
Experimental cache primitive for direct cache lookups.
curl -H "Authorization: Bearer cp_xxx" \ "$BASE/api/v1/cache?provider=openai&model=gpt-4o&prompt=Hello"
/api/v1/cacheCache Store
Experimental cache primitive for explicit cache writes.
curl -X POST "$BASE/api/v1/cache" \
-H "Authorization: Bearer cp_xxx" \
-H "Content-Type: application/json" \
-d '{"provider":"openai","model":"gpt-4o","prompt":"Hello","response_content":"Hi there!","ttl_seconds":3600}'/api/v1/forecast?lookback_days=30&horizon_days=7Forecast
curl -H "Authorization: Bearer cp_xxx" \ "$BASE/api/v1/forecast?lookback_days=30&horizon_days=7"
Open /dashboard/prompts to manage prompt versions, or /dashboard/team to manage team members.
Use prompt versions to roll back templates safely without editing live content directly.
Team members can accept pending invitations sent to their account email before accessing a project.