Skip to main content

ShapleyCut service

Project description

ShapleyCut API

Dedicated service for the ShapleyCut compression engine. This package exposes HTTP endpoints for optimizing memory and running the gateway mode.

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 /health
  • POST /v1/optimize
  • POST /v1/chat/completions
  • POST /v1/responses
  • GET /v1/metrics
  • GET /v1/metrics/export

Environment

LLM credentials (server side only):

  • GITHUB_TOKEN or GH_TOKEN
  • GITHUB_INFERENCE_BASE_URL (default: https://models.github.ai/inference)
  • OPENAI_API_KEY
  • OPENAI_BASE_URL (default: https://api.openai.com/v1)

Gateway settings:

  • SHAPLEYCUT_GATEWAY_PROVIDER (github_azure, openai, anthropic)
  • SHAPLEYCUT_GATEWAY_BASE_URL
  • SHAPLEYCUT_GATEWAY_API_KEY_ENV
  • SHAPLEYCUT_GATEWAY_API_KEY
  • SHAPLEYCUT_GATEWAY_REQUIRE_KEY
  • SHAPLEYCUT_GATEWAY_ALLOW_OVERRIDE
  • SHAPLEYCUT_GATEWAY_LOG
  • SHAPLEYCUT_GATEWAY_DB
  • SHAPLEYCUT_GATEWAY_METRICS_MAX
  • SHAPLEYCUT_GATEWAY_CACHE_MAX
  • SHAPLEYCUT_GATEWAY_CACHE_TTL_S

Notes

  • /v1/responses is not supported when SHAPLEYCUT_GATEWAY_PROVIDER=github_azure. Use /v1/chat/completions or set the provider to openai.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shapleycut_api-0.2.2.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shapleycut_api-0.2.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file shapleycut_api-0.2.2.tar.gz.

File metadata

  • Download URL: shapleycut_api-0.2.2.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for shapleycut_api-0.2.2.tar.gz
Algorithm Hash digest
SHA256 91d45150bd220bdf593e7d39a2b798e033bcd8fdb835bd3bd92b820536d6aff1
MD5 1f84c99d5b76a2c6ca77ac5393d574d9
BLAKE2b-256 dca53266af3632fae3fefff3a3125f3aaaccdf5be68394b8fe85dc0098c1bb57

See more details on using hashes here.

Provenance

The following attestation bundles were made for shapleycut_api-0.2.2.tar.gz:

Publisher: publish.yml on iv4n-ga6l/ShapleyCut

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file shapleycut_api-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: shapleycut_api-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for shapleycut_api-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6f857e5957cb7dce5a02fa679832af100f6f4a8895ea9209956f37fce60922c8
MD5 e01e391f60f4f14ce01f5c00634ac837
BLAKE2b-256 0d5e220433500f900185f82d028aad9eea2d9782c362b620773ac06e7d82819f

See more details on using hashes here.

Provenance

The following attestation bundles were made for shapleycut_api-0.2.2-py3-none-any.whl:

Publisher: publish.yml on iv4n-ga6l/ShapleyCut

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page