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.5

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.5
File Size Uploaded Provenance Actions
moda_ai-0.1.5.tar.gz 326.6 kB With provenance Details for moda_ai-0.1.5.tar.gz

Built distribution (wheel)

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

Total release size: 419.4 kB

Release files / moda_ai-0.1.5.tar.gz

Download URL moda_ai-0.1.5.tar.gz
Size 326.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9b07040e7ce17129667f2039ee9f4042ce1c71e871ab8f7af8e5cb3ca1b277c0
BLAKE2b-256 checksum
How to use checksums
df14d6dcf7bb126f979fbdef6ee330f6c20bb5eadf4fec91b0f47d9a40bbb71f
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.5-py3-none-any.whl

Download URL moda_ai-0.1.5-py3-none-any.whl
Size 92.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04db08e1e03ee63da6e99b2eb34907f8d9d32a7d82cd2223759a022bff074307
BLAKE2b-256 checksum
How to use checksums
c50e9cd9ac9b21dc80d1d15cc4eab2e4e6b7a1d74b1024c60923090391637b79
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.5

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.5.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