Prerequisites
- A Moda workspace. Accounts are provisioned by the Moda team; teammates join by invitation (Settings → Members & roles).
- A Moda API key. Create one in the dashboard at Settings → Ingestion keys — the full key is shown once, at creation.
- An OpenAI API key (or an Anthropic API key for the variant below).
- Python 3.10 or later, or Node.js 18 or later.
1
Install the SDK
Install
moda-ai alongside the provider client you already use:The PyPI package is named
moda-ai, but you import it as moda.2
Initialize Moda and make a call
Initialize the SDK before you construct the provider client, make the call as usual, and flush before the process exits.
The Node.js sample uses top-level
await, which requires ES modules ("type": "module" in package.json). In a CommonJS project, wrap the code in an async function.3
Add conversation and user context
Set a conversation ID and a user ID before the first model call of a session — use an identifier your application already has, such as a session, thread, or run ID — so every call is attributed to the right conversation and user:Calls made while these are set are attributed to that conversation and user. Both SDKs also offer scoped forms that are safe in concurrent servers:
with moda.set_conversation_id(...) in Python, and withConversationId(...) / withContext(...) (imported from moda-ai) in Node.js. See the Python SDK and Node.js SDK pages for details.4
Verify in the dashboard
Open https://moda.dev/dashboard and go to Conversations. Your conversation appears within minutes of the flush; click the row to open its Full Trace view showing the prompt and the model’s response. Emotion, tool-failure, laziness, and hallucination analyses appear on the Signals page within minutes.
Anthropic variant
The SDKs also auto-instrument the Anthropic client libraries. Install withpip install moda-ai anthropic or npm install moda-ai @anthropic-ai/sdk, then:
Troubleshooting
Next steps
- Moda SDK for Python — init options, context managers, and supported instrumentations.
- Moda SDK for Node.js — init options, scoped context, manual capture, and OpenTelemetry coexistence.
- Ingestion overview — other ways to send data, including OpenTelemetry and the HTTP API.
- Dashboard overview — what to look at once data is flowing.