Skip to main content

hugging-bay

A thin, typed Python client for the Hugging Bay API: verified open-model discovery, safe-to-run verdicts, provenance passports, and offline lockfile verification.

The client is intentionally minimal — one method per endpoint, no client-side magic. Verdicts, fits, and identities are computed by the server and returned as parsed JSON.

Install

pip install hugging-bay

Requires Python 3.9+. The only runtime dependency is httpx.

Usage

from hugging_bay import Client

client = Client()  # defaults to https://huggingbay.xyz
# Optional auth: Client(token="sk-...") sends Authorization: Bearer <token>.
# The token is never printed in repr()/str() and never logged.

1. Find a commercial-safe model for a rig

from hugging_bay import Client

client = Client()
result = client.find_model(
    task="coding",
    gpu="rtx4090-24",
    ctx=8192,
    device_family="nvidia",
    commercial=True,
    limit=3,
)
best = result["bestPick"]
print(best["repo"], "-> safe-to-run:", best["safety"]["verdict"])

2. Verify a source URL

from hugging_bay import Client, HuggingBayError

client = Client()
try:
    resolved = client.resolve("https://huggingface.co/meta-llama/Llama-3.1-8B")
    print("resolved artifact:", resolved.get("artifactId") or resolved)
except HuggingBayError as err:
    print("could not resolve:", err.status, err.error)

3. Pull plan, then verify the lock against local files

from hugging_bay import Client, verify_lock

client = Client()
artifact_id = "art_123"

# The hosted download plan (signed manifest + per-file hashes).
plan = client.download_plan(artifact_id)

# ... download the files into ./models/art_123 using the plan ...

# Recompute local hashes and compare to the bay.lock document — pure stdlib,
# no network.
lock = client.lock(artifact_id)
report = verify_lock(lock, root_dir="./models/art_123")
if report["ok"]:
    print(f"verified {report['checked']} files")
else:
    for mismatch in report["mismatches"]:
        print("BAD:", mismatch["path"], mismatch["reason"])

4. Diagnose a failing run

from hugging_bay import Client

client = Client()
diagnosis = client.doctor(
    log_text="llama_model_load: error loading model: CUDA out of memory",
    runtime="llama.cpp",
)
if diagnosis["topFix"]:
    print("top fix:", diagnosis["topFix"])
for alt in diagnosis.get("smallerHostedAlternatives", []):
    print("smaller option:", alt)

API surface

Method Endpoint
find_model(task, gpu, ctx, device_family, commercial, limit) GET /api/agents/find-model
artifact(id) GET /api/v1/artifacts/{id}
safety(id) GET /api/v1/artifacts/{id}/safety
bundle(id) GET /api/artifacts/{id}/bundle
passport(id) GET /api/artifacts/{id}/passport
resolve(repo_or_url) GET /api/resolve?repo=
download_plan(id) GET /api/v1/artifacts/{id}/download-plan
lock(id) GET /api/artifacts/{id}/lock
doctor(log_text, runtime) POST /api/doctor
recipes() / recipe(slug) GET /api/recipes[/{slug}]
verify_lock(lock_dict, root_dir) offline, stdlib only

Errors

Any response with status >= 400 raises HuggingBayError(status, body). The server's error field is exposed as .error; the parsed body is on .body. On a 503 with a Retry-After header the client waits once and retries a single time before raising.

License

MIT

Download files

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

Source Distribution

hugging_bay-0.1.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

hugging_bay-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file hugging_bay-0.1.0.tar.gz.

File metadata

  • Download URL: hugging_bay-0.1.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for hugging_bay-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56c4652a86ab4e8faeda49d9a6e42d5197d9d9e42cdf397edc0dbca22e4a3e4a
MD5 9710f52fa9e46994a1135def127b3465
BLAKE2b-256 e20ca485081a7a265f67975d334bffef5b4df3d52c36fd069919ef5472f91a4e

See more details on using hashes here.

File details

Details for the file hugging_bay-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hugging_bay-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for hugging_bay-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 950156a4b3841e4ab747eb7dbebf885fc26bbe173b6ec697c7906162d48d9304
MD5 06252c7d2926609794765607abc2287f
BLAKE2b-256 8aa1a0cca20f5ea55585455f6ed60943bc24f346acb9045a1a34aed6d6fe2f10

See more details on using hashes here.

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