Introduction
Public packages for product LLM attribution and coding-agent spend collection.
View sourcetrAIce connects AI usage to the business dimensions that explain it: customer, user, feature, workflow, agent, and team. The public repository provides product-runtime SDKs, a direct HTTP contract, and local coding-agent collectors.
Choose a data path
Product usage and internal AI-tool usage are separate data streams. Choose the path that matches who initiated the spend.
| Path | Use it for | Destination | Start here |
|---|---|---|---|
| Product SDKs | LLM calls made by your application for customers or end users | /api/v1/events | Product SDKs |
| Internal Spend collector | Claude Code and Codex usage by employees and teams | /api/v1/internal-usage | Collector overview |
| Ask trAIce | Spend questions and explicitly confirmed Team actions | /api/v1/ask or MCP | Ask trAIce |
Do not send employee coding-agent usage as a product event. Do not use customer identifiers as employee identifiers. Keeping the two paths separate preserves clear allocation and reporting.
Public packages
| Package | Purpose | Registry | Source |
|---|---|---|---|
@traice/sdk | TypeScript and Node.js product-runtime metering, adapters, analytics, and request guardrails | npm | packages/sdk |
traice-sdk | Python product-runtime collection for OpenAI, Anthropic, LangChain, and LangGraph | PyPI | packages/python |
@traice/collector | Local Claude Code and Codex telemetry collection | npm | packages/collector |
@traice/protocol | Shared public event types, validation, normalization, and redaction helpers | npm | packages/protocol |
Product attribution model
Every product integration can attach the same dimensions:
tenantIdidentifies the customer or account that pays you.userIdidentifies the end user who initiated the call.featureidentifies the product capability or request path.workflowId,runId, andstepIdidentify multi-step executions.agentIdandtoolNameidentify agent and tool activity.outcomeandretryCountexplain result quality and retry behavior.metadatacarries additional structured context that is safe to send.
tenantId is the primary dimension for customer-level AI contribution margin. Use the same stable customer identifier that your billing or revenue data uses.
Security and privacy
Store the trAIce API key in your secret manager and provide it through TRAICE_API_KEY. Provider keys remain in your infrastructure and are never sent to trAIce.
Product attribution does not require prompts or model outputs. The Python SDK never sends either. The TypeScript SDK sends them only when you explicitly pass prompt or output and your workspace is configured to accept samples. Collectors keep prompt capture off by default.
Next steps
- Create a workspace key and send a first event.
- Choose TypeScript and Node.js, Python, or HTTP and cURL.
- Use the API reference for signatures, event contracts, and source links.