Skip to main content
Syncing gives every prompt an immutable version; attribution tells Moda which version served each production call. You attribute calls by stamping prompt identifiers on the data you already send — as event fields on the HTTP Ingestion API, as span attributes over OpenTelemetry, or as telemetry metadata with the Vercel AI SDK.
There is no SDK call that renders a prompt and attributes it automatically. Auto-instrumented OpenAI and Anthropic calls made through the Moda SDKs currently carry no prompt attribution — the SDKs expose no option to stamp these fields on auto-generated spans. Use one of the mechanisms on this page.

Where the identifiers come from

moda prompts sync writes .moda/prompts.lock.json with the registry IDs for every prompt:
.moda/prompts.lock.json
Read the lockfile at startup (or bake the values in at build time) and stamp promptId and versionId on the calls that use that prompt.

Identifier fields

How much you send determines what you get:
  • Linking to a prompt requires prompt_id equal to the registry prompt ID, or prompt_name equal to the prompt key. On OTLP paths, moda.prompt_key alone is enough — the ID and name default to the key.
  • Per-version usage requires prompt_version_id. Without it, calls link to the prompt but not to a specific version.
  • prompt_version is a free-form display string (for example a semver or git SHA of your choosing); it defaults to the version ID when omitted.
Stamp the fields on the assistant events or LLM spans produced by the prompt.

HTTP Ingestion API

Set the prompt_* fields directly on /v1/ingest events:
Response
See HTTP API for the full event schema, batch limits, and error envelope.

OpenTelemetry span attributes

If you export OTLP traces to Moda from your own OpenTelemetry setup, set the moda.prompt_* attributes on each LLM span (see OpenTelemetry for exporter setup). Moda also reads gen_ai.prompt.name as a fallback for the prompt name. With the Moda SDK for Node.js, manual capture via withLLMCall exposes the underlying OTel span, so you can stamp the attributes there. Use this for calls the SDK does not auto-instrument:
app.ts
withLLMCall is Node.js only. The Moda SDK for Python has no manual-capture equivalent; from Python, send attributed events through the HTTP API or set the attributes in your own OpenTelemetry instrumentation.

Vercel AI SDK

Pass the identifiers in the metadata of Moda.getVercelAITelemetry. The AI SDK forwards metadata keys as span attributes that Moda reads:
app.ts
Moda.getVercelAITelemetry() snapshots the conversation and user context at the moment it is called. Set Moda.conversationId (or wrap the call in withConversationId) before creating the telemetry config, or the call is grouped without your conversation ID.
See Vercel AI SDK for the full integration, including streaming and tool calls.

What attribution unlocks

  • Runtime usage per version. The prompt detail page (Dashboard → Prompts → your prompt, Versions tab) shows calls, conversations, and input/output tokens grouped by version. Rows appear within minutes of ingestion.
  • Version-aware analysis. Attributed conversations let you compare how different versions behave in production and give prompt experiments a baseline tied to real versions.
Calls without prompt_version_id still count toward the prompt’s overall usage as long as they carry the prompt key or ID.

Next steps