MOSS cryptographic signing integration for OpenAI
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moss_openai-1.0.0.tar.gz.
File metadata
- Download URL: moss_openai-1.0.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
249d40b3f01f0a65aa9058d8c3e9cf15ae36c4cecb863d989527f8016ff307dd
|
|
| MD5 |
58468e9aa7991c2b522540d17b576c7f
|
|
| BLAKE2b-256 |
0e55fef42d3fa483b79c4be3be278409e0c74a79d79c1831868ef16880025a46
|
Provenance
The following attestation bundles were made for moss_openai-1.0.0.tar.gz:
Publisher:
publish.yml on mosscomputing/moss-openai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moss_openai-1.0.0.tar.gz -
Subject digest:
249d40b3f01f0a65aa9058d8c3e9cf15ae36c4cecb863d989527f8016ff307dd - Sigstore transparency entry: 854527433
- Sigstore integration time:
-
Permalink:
mosscomputing/moss-openai@a489e64770d3abc44a02cc953997d934aa11acb5 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mosscomputing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a489e64770d3abc44a02cc953997d934aa11acb5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file moss_openai-1.0.0-py3-none-any.whl.
File metadata
- Download URL: moss_openai-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa8f248cf94a9496e9dd118f3009d8be489a2add52eef3985268a2d938ff90b6
|
|
| MD5 |
fc13ee87c67f90c776698e7dcbdb670e
|
|
| BLAKE2b-256 |
f549bcc9972dafcc062c7c9e9644cd87b48fde832dfc0ae523434acec05a5b79
|
Provenance
The following attestation bundles were made for moss_openai-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on mosscomputing/moss-openai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moss_openai-1.0.0-py3-none-any.whl -
Subject digest:
aa8f248cf94a9496e9dd118f3009d8be489a2add52eef3985268a2d938ff90b6 - Sigstore transparency entry: 854527436
- Sigstore integration time:
-
Permalink:
mosscomputing/moss-openai@a489e64770d3abc44a02cc953997d934aa11acb5 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mosscomputing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a489e64770d3abc44a02cc953997d934aa11acb5 -
Trigger Event:
release
-
Statement type: