Skip to content

[codex] Add Hugging Face billing callback - #153

Draft
sirouk wants to merge 1 commit into
chutesai:mainfrom
sirouk:codex/hf-billing-callback
Draft

[codex] Add Hugging Face billing callback#153
sirouk wants to merge 1 commit into
chutesai:mainfrom
sirouk:codex/hf-billing-callback

Conversation

@sirouk

@sirouk sirouk commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add Inference-Id response headers using the existing Chutes invocation ID.
  • Add POST /partners/huggingface/billing for HF requestIds -> costNanoUsd lookups.
  • Scope billing lookups to the authenticated Chutes user and allow read-only billing API-key scopes.

Notes

This keeps HF on direct Chutes infrastructure: inference can use llm.chutes.ai/v1, and billing can use api.chutes.ai/partners/huggingface/billing. Unknown request IDs return 0; known IDs use persisted invocation metrics["b"] converted to integer nano-USD.

Checks

  • PATH="$PWD/.venv/bin:$PATH" make lint
  • DEBUG=false uv run pytest -q tests/unit/test_huggingface_billing.py
  • uv run python -m compileall api/invocation/router.py api/payment/router.py api/main.py api/api_key/schemas.py tests/unit/test_huggingface_billing.py

@sirouk
sirouk force-pushed the codex/hf-billing-callback branch from 5be14da to 48461c7 Compare May 29, 2026 17:01
@sirouk
sirouk force-pushed the codex/hf-billing-callback branch from 48461c7 to 535d264 Compare May 29, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant