ShapleyCut API
Dedicated service for the ShapleyCut compression engine. This package exposes HTTP endpoints for optimizing memory and running the gateway mode.
Core engine: https://pypi.org/project/shapleycut-core/
Install
pip install shapleycut-api
Quickstart
python -m uvicorn shapleycut_api.main:app --host 0.0.0.0 --port 8000
If you are on Python 3.14 and see httptools errors, use:
python -m uvicorn shapleycut_api.main:app --host 0.0.0.0 --port 8000 --http h11
SDK snippet (Python)
from shapleycut import MemoryMessage, optimize_messages
messages = [
MemoryMessage(role="system", content="You are a helpful assistant."),
MemoryMessage(role="user", content="Summarize the project status."),
MemoryMessage(role="assistant", content="We shipped MVP and added gateway mode."),
]
out = optimize_messages(messages, max_output_tokens=512)
print(out.optimized_memory)
Endpoints
GET /healthPOST /v1/optimizePOST /v1/chat/completionsPOST /v1/responsesGET /v1/metricsGET /v1/metrics/export
Environment
LLM credentials (server side only):
GITHUB_TOKENorGH_TOKENGITHUB_INFERENCE_BASE_URL(default:https://models.github.ai/inference)OPENAI_API_KEYOPENAI_BASE_URL(default:https://api.openai.com/v1)
Gateway settings:
SHAPLEYCUT_GATEWAY_PROVIDER(github_azure,openai,anthropic)SHAPLEYCUT_GATEWAY_BASE_URLSHAPLEYCUT_GATEWAY_API_KEY_ENVSHAPLEYCUT_GATEWAY_API_KEYSHAPLEYCUT_GATEWAY_REQUIRE_KEYSHAPLEYCUT_GATEWAY_ALLOW_OVERRIDESHAPLEYCUT_GATEWAY_LOGSHAPLEYCUT_GATEWAY_DBSHAPLEYCUT_GATEWAY_METRICS_MAXSHAPLEYCUT_GATEWAY_CACHE_MAXSHAPLEYCUT_GATEWAY_CACHE_TTL_S
Notes
/v1/responsesis not supported whenSHAPLEYCUT_GATEWAY_PROVIDER=github_azure. Use/v1/chat/completionsor set the provider toopenai.
Metadata
Release files for shapleycut-api 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shapleycut_api-0.2.4.tar.gz | 8.3 kB | With provenance | Details for shapleycut_api-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shapleycut_api-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for shapleycut_api-0.2.4-py3-none-any.whl |
Total release size: 17.6 kB
Release files / shapleycut_api-0.2.4.tar.gz
| Download URL | shapleycut_api-0.2.4.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9d5ea93034f49b4bfeeeea250eadb4b39f46abdb53a4d0cec9010ea7c71b11d
|
|
BLAKE2b-256 checksum How to use checksums |
877b268b662eb6bd289dd1b4dbdd35d9cf0336b0dbb90ab683395ec9a47644f9
|
| 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 Apr 7, 2026.
Transparency logRelease files / shapleycut_api-0.2.4-py3-none-any.whl
| Download URL | shapleycut_api-0.2.4-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1e49957adfcc4d41e6d375d015738605746a535d461564c4c3f3210688449e6
|
|
BLAKE2b-256 checksum How to use checksums |
5282805895b2b866e82eeaaba20da4ef2d178b5ddda72f20925bd8f9b2c030e9
|
| 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 Apr 7, 2026.
Transparency logSecurity for shapleycut-api 0.2.4
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.
Attestation for shapleycut_api-0.2.4.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 Apr 7, 2026.
Transparency logA 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.