bithuman-cli 2.3.5__tar.gz → 2.3.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bithuman-cli
3
- Version: 2.3.5
3
+ Version: 2.3.6
4
4
  Summary: bitHuman CLI — `bithuman run model.imx` (live avatar) / `bithuman render` / `bithuman info` / `bithuman doctor`. Bundles the Rust CLI binary, the conversation brain, and the on-device plugins. Depends on the `bithuman` Python SDK.
5
5
  Keywords: bithuman,avatar,essence,lipsync,cli,livekit
6
6
  Author-Email: bitHuman <hello@bithuman.ai>
@@ -25,7 +25,7 @@ build-backend = "scikit_build_core.build"
25
25
 
26
26
  [project]
27
27
  name = "bithuman-cli"
28
- version = "2.3.5"
28
+ version = "2.3.6"
29
29
  description = "bitHuman CLI — `bithuman run model.imx` (live avatar) / `bithuman render` / `bithuman info` / `bithuman doctor`. Bundles the Rust CLI binary, the conversation brain, and the on-device plugins. Depends on the `bithuman` Python SDK."
30
30
  readme = "README.md"
31
31
  requires-python = ">=3.10"
@@ -218,18 +218,35 @@ def _mint_realtime_token() -> tuple[str, str]:
218
218
  req = _urlreq.Request(
219
219
  f"{_api_base()}/v1/realtime/ephemeral-token",
220
220
  data=_json.dumps({"model": model}).encode(),
221
- headers={"api-secret": api_secret, "Content-Type": "application/json"},
221
+ headers={
222
+ "api-secret": api_secret,
223
+ "Content-Type": "application/json",
224
+ # A real User-Agent is required: the default "Python-urllib/x.y"
225
+ # is blocked at the edge (Cloudflare) with a 403 before it reaches
226
+ # the API.
227
+ "User-Agent": "bithuman-cli",
228
+ },
222
229
  method="POST",
223
230
  )
224
231
  try:
225
232
  with _urlreq.urlopen(req, timeout=15) as r:
226
233
  payload = _json.loads(r.read().decode())
227
234
  except _urlerr.HTTPError as e:
228
- if e.code in (402, 403):
235
+ # Map the status precisely — do NOT call everything "out of credits".
236
+ if e.code == 402:
229
237
  raise RuntimeError(
230
238
  "You are out of credits for the bitHuman-managed brain. "
231
239
  "Top up at https://www.bithuman.ai/upgrade"
232
240
  ) from e
241
+ if e.code == 429:
242
+ raise RuntimeError(
243
+ "Too many sessions started just now — wait a moment and retry."
244
+ ) from e
245
+ if e.code in (401, 403):
246
+ raise RuntimeError(
247
+ f"managed brain: not authorized to mint a token (HTTP {e.code}). "
248
+ "Try `bithuman login` again."
249
+ ) from e
233
250
  raise RuntimeError(f"managed brain: token mint failed (HTTP {e.code})") from e
234
251
  data = payload.get("data", payload)
235
252
  value = data.get("value")
File without changes