Skip to main content

moda-ai

Moda's Python SDK for LLM observability with automatic conversation threading. Built on OpenTelemetry.

Installation

pip install moda-ai

Quick Start

import moda
from openai import OpenAI

moda.init("YOUR_MODA_API_KEY")

# Set conversation ID for your session (recommended)
moda.conversation_id = "session_" + session_id

client = OpenAI()
response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Hello!"}]
)

moda.flush()

Conversation Tracking

For production use, explicitly set a conversation ID to group related LLM calls:

# Property-style (recommended)
moda.conversation_id = "support_ticket_123"
client.chat.completions.create(...)
moda.conversation_id = None  # clear when done

# Or use the setter function
moda.set_conversation_id_value("support_ticket_123")
moda.set_conversation_id_value(None)  # clear

# Or use context manager (scoped)
with moda.set_conversation_id("support_ticket_123"):
    client.chat.completions.create(...)

Setting User ID

Associate LLM calls with specific users:

moda.user_id = "user_12345"
client.chat.completions.create(...)
moda.user_id = None  # clear

OpenClaw Integration

OpenClaw can export OpenTelemetry data via its diagnostics-otel plugin. Moda provides helpers to generate OpenClaw config/env and trace OpenClaw runtime operations.

import moda
from moda.openclaw import (
    get_openclaw_otel_config,
    get_openclaw_env,
    run_openclaw_cli,
)

moda.init("YOUR_MODA_API_KEY")

config = get_openclaw_otel_config(service_name="openclaw-gateway")
env = get_openclaw_env()

# Optional traced CLI invocation
result = run_openclaw_cli(["--help"], check=False)

# If OpenClaw is not installed globally, run via npx:
result = run_openclaw_cli(
    ["agent", "--help"],
    command_prefix=["npx", "-y", "openclaw@latest"],
    check=False,
)
print(result.returncode)

Automatic Fallback

If you don't set a conversation ID, the SDK automatically computes one from the first user message and system prompt. This works for simple use cases but explicit IDs are recommended for production.

Full Documentation

See the main repository README for complete documentation.

Metadata

Release files for moda-ai 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moda-ai 0.1.6
File Size Uploaded Provenance Actions
moda_ai-0.1.6.tar.gz 328.9 kB With provenance Details for moda_ai-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for moda-ai 0.1.6
File Interpreter ABI Platform Actions
moda_ai-0.1.6-py3-none-any.whl Python 3 none any Details for moda_ai-0.1.6-py3-none-any.whl

Total release size: 422.8 kB

Release files / moda_ai-0.1.6.tar.gz

Download URL moda_ai-0.1.6.tar.gz
Size 328.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0725e5d6d794c50569f0f116d6276b967a2f5344e3a66c702dab07992ae0eb17
BLAKE2b-256 checksum
How to use checksums
72215ac3bf54e5f7e75111022a3c10edda6b510ec3abc8f430c4fbb45b59c67d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / moda_ai-0.1.6-py3-none-any.whl

Download URL moda_ai-0.1.6-py3-none-any.whl
Size 93.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83cc6d08041374ac1359a1103b079cc8ce071f4ff2d9291c7408173a1b3adda2
BLAKE2b-256 checksum
How to use checksums
4b31ca08e223e7e2b810f5314255b5deaa659c9bd856ee03fd06206a7fceeb12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for moda-ai 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for moda_ai-0.1.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page