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
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_idequal to the registry prompt ID, orprompt_nameequal to the prompt key. On OTLP paths,moda.prompt_keyalone 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_versionis a free-form display string (for example a semver or git SHA of your choosing); it defaults to the version ID when omitted.
HTTP Ingestion API
Set theprompt_* fields directly on /v1/ingest events:
Response
OpenTelemetry span attributes
If you export OTLP traces to Moda from your own OpenTelemetry setup, set themoda.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 themetadata of Moda.getVercelAITelemetry. The AI SDK forwards metadata keys as span attributes that Moda reads:
app.ts
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.
prompt_version_id still count toward the prompt’s overall usage as long as they carry the prompt key or ID.
Next steps
- Prompt workflow — where the lockfile and version IDs come from.
- Prompt experiments — replay-based comparison of prompt versions.
- HTTP API — full
/v1/ingestevent schema and limits. - OpenTelemetry — exporting OTLP traces to Moda from your own setup.