moss-openai
MOSS signing integration for OpenAI SDK. Unsigned output is broken output.
Installation
pip install moss-openai
Quick Start
Sign tool calls, completions, and messages from OpenAI:
from openai import OpenAI
from moss_openai import sign_tool_call, sign_completion, sign_message
client = OpenAI()
# Get a completion with tool calls
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "What's the weather?"}],
tools=[{"type": "function", "function": {"name": "get_weather", ...}}]
)
# Sign the completion
result = sign_completion(response, agent_id="weather-bot")
print(f"Signed: {result.signature[:20]}...")
# Sign individual tool calls
for choice in response.choices:
if choice.message.tool_calls:
for tool_call in choice.message.tool_calls:
result = sign_tool_call(tool_call, agent_id="weather-bot")
Enterprise Mode
Set MOSS_API_KEY for automatic policy evaluation:
import os
os.environ["MOSS_API_KEY"] = "your-api-key"
from moss_openai import sign_tool_call, enterprise_enabled
print(f"Enterprise: {enterprise_enabled()}") # True
result = sign_tool_call(
tool_call,
agent_id="finance-bot",
context={"user_id": "u123"}
)
if result.blocked:
print(f"Blocked by policy: {result.policy.reason}")
Verification
from moss_openai import verify_envelope
verify_result = verify_envelope(result.envelope)
if verify_result.valid:
print(f"Signed by: {verify_result.subject}")
All Functions
| Function | Description |
|---|---|
sign_tool_call() |
Sign a tool call |
sign_tool_call_async() |
Async version |
sign_completion() |
Sign a ChatCompletion |
sign_completion_async() |
Async version |
sign_message() |
Sign a message |
sign_message_async() |
Async version |
sign_function_call() |
Sign legacy function call |
sign_function_call_async() |
Async version |
verify_envelope() |
Verify a signed envelope |
Enterprise Features
| Feature | Free | Enterprise |
|---|---|---|
| Local signing | ✓ | ✓ |
| Offline verification | ✓ | ✓ |
| Policy evaluation | - | ✓ |
| Evidence retention | - | ✓ |
| Audit exports | - | ✓ |
Links
- moss-sdk - Core MOSS SDK
- mosscomputing.com - Project site
License
This package is licensed under the Business Source License 1.1.
- Free for evaluation, testing, and development
- Free for non-production use
- Production use requires a MOSS subscription
- Converts to Apache 2.0 on January 25, 2030
Metadata
Release files for moss-openai 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| moss_openai-1.0.0.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| moss_openai-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.3 kB
Release files / moss_openai-1.0.0.tar.gz
| Download URL | moss_openai-1.0.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
249d40b3f01f0a65aa9058d8c3e9cf15ae36c4cecb863d989527f8016ff307dd
|
|
BLAKE2b-256 checksum How to use checksums |
0e55fef42d3fa483b79c4be3be278409e0c74a79d79c1831868ef16880025a46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jan 25, 2026.
Transparency logRelease files / moss_openai-1.0.0-py3-none-any.whl
| Download URL | moss_openai-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa8f248cf94a9496e9dd118f3009d8be489a2add52eef3985268a2d938ff90b6
|
|
BLAKE2b-256 checksum How to use checksums |
f549bcc9972dafcc062c7c9e9644cd87b48fde832dfc0ae523434acec05a5b79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jan 25, 2026.
Transparency log