Official Mythos SDK for Python — launch token verification, usage reporting, and handshake
Project description
mythos-sdk
Official Mythos SDK for Python — launch token verification, usage reporting, and handshake.
Install
pip install mythos-sdk[fastapi]
Quick start
from fastapi import FastAPI, Depends
from mythos_sdk import require_launch_token, report_usage, create_handshake_router
app = FastAPI()
# Handshake endpoint — Mythos pings this before publishing your listing
app.include_router(create_handshake_router())
# Protected route — verifies and consumes the launch token automatically
@app.get("/dashboard")
async def dashboard(session = Depends(require_launch_token())):
# session = MythosSession(user_id, email, display_name, listing_id, session_jti)
await report_usage(session.session_jti, credits=1, reason="page-view")
return {"ok": True}
Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
MYTHOS_LISTING_ID |
Yes* | — | Your listing ID |
MYTHOS_LISTING_IDS |
Yes* | — | Comma-separated listing IDs (overrides above) |
MYTHOS_API_URL |
No | https://api.mythos.work |
API base URL override |
*One of MYTHOS_LISTING_ID or MYTHOS_LISTING_IDS is required.
API
require_launch_token()
FastAPI dependency. Verifies the RS256 launch token from ?lt=, enforces single-use semantics, and returns a MythosSession. Returns 401 if the token is missing, invalid, or already consumed.
report_usage(session_jti, *, credits, reason=None)
Reports credit consumption against a session. Call after delivering value to the user.
create_handshake_router()
Returns a FastAPI APIRouter that mounts GET /.well-known/mythos-handshake. Mythos calls this endpoint during listing publish to confirm the SDK is installed and reachable.
verify_launch_token(token)
Low-level token verifier. Returns the decoded payload. Use require_launch_token() dependency instead for most cases.
Security
- Tokens verified via RS256 against the Mythos JWKS endpoint
alg: nonerejected as a hard block- Single-use enforcement is non-skippable (ADR-0003)
- JWKS keys cached 10 minutes with automatic re-fetch on key rotation
License
Apache-2.0 — see LICENSE.
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 mythos_sdk-0.0.4.tar.gz.
File metadata
- Download URL: mythos_sdk-0.0.4.tar.gz
- Upload date:
- Size: 91.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02cfaddfc20be95cfe281a2896fd6132d681ac8ced76ef0097b0ff3582c4853b
|
|
| MD5 |
c501fb5f8d126a28511d518fbb13d473
|
|
| BLAKE2b-256 |
28a361da468f3162c027c2e04f33140f916d5d11ad53838011c6cb33592dbf7a
|
Provenance
The following attestation bundles were made for mythos_sdk-0.0.4.tar.gz:
Publisher:
publish.yml on Mythoswork/mythos-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mythos_sdk-0.0.4.tar.gz -
Subject digest:
02cfaddfc20be95cfe281a2896fd6132d681ac8ced76ef0097b0ff3582c4853b - Sigstore transparency entry: 2136235655
- Sigstore integration time:
-
Permalink:
Mythoswork/mythos-sdk@ce0de8f03dfc26104374458072234b1b88538769 -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/Mythoswork
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ce0de8f03dfc26104374458072234b1b88538769 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mythos_sdk-0.0.4-py3-none-any.whl.
File metadata
- Download URL: mythos_sdk-0.0.4-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c390624e034cf74cbd39c5087685bd3d39dfa01c5c7cee55775d9bcc35b88f3f
|
|
| MD5 |
b9ba838496aac61cd4c7c80748c8f70a
|
|
| BLAKE2b-256 |
c25418476670ff354ac6e7f401daaf78850cfe603c980cb144a4c226e71c71ec
|
Provenance
The following attestation bundles were made for mythos_sdk-0.0.4-py3-none-any.whl:
Publisher:
publish.yml on Mythoswork/mythos-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mythos_sdk-0.0.4-py3-none-any.whl -
Subject digest:
c390624e034cf74cbd39c5087685bd3d39dfa01c5c7cee55775d9bcc35b88f3f - Sigstore transparency entry: 2136235742
- Sigstore integration time:
-
Permalink:
Mythoswork/mythos-sdk@ce0de8f03dfc26104374458072234b1b88538769 -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/Mythoswork
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ce0de8f03dfc26104374458072234b1b88538769 -
Trigger Event:
push
-
Statement type: