BigPizzaV3/CodexPlusPlus · error · anyhow::Error
HTTP {}:{}
Error message
HTTP {}:{} What it means
Thrown by fetch_sub2api_billing_info when the billing endpoint responds with a non-success HTTP status: {status} and the response body text are formatted into the message. The offending input is the upstream sub2api service's answer (bad key, quota, outage); unlike network errors this fires after a completed HTTP exchange.
Source
Thrown at crates/codex-plus-core/src/sub2api.rs:67
}
let api_key = profile.api_key.trim();
if api_key.is_empty() {
anyhow::bail!("API Key 不能为空");
}
let endpoint = sub2api_billing_endpoint(base_url);
let client = crate::http_client::proxied_client(&profile.user_agent)?;
let response = client
.get(&endpoint)
.bearer_auth(api_key)
.header("x-api-key", api_key)
.send()
.await
.with_context(|| format!("请求 {endpoint} 失败"))?;
let status = response.status();
let body = response.text().await.unwrap_or_default();
if !status.is_success() {
anyhow::bail!(
"HTTP {}:{}",
status.as_u16(),
sub2api_error_message(&body).unwrap_or_else(|| "上游拒绝读取倍率".to_string())
);
}
let parsed: Sub2ApiBillingResponse =
serde_json::from_str(&body).context("倍率接口没有返回有效 JSON")?;
validate_sub2api_billing_response(&parsed)?;
Ok(Sub2ApiBillingInfo {
endpoint,
group_rate_multiplier: parsed.group_rate_multiplier,
user_rate_multiplier: parsed.user_rate_multiplier,
resolved_rate_multiplier: parsed.resolved_rate_multiplier,
peak_rate_enabled: parsed.peak_rate_enabled,
peak_rate_multiplier: parsed.peak_rate_multiplier,
applied_peak_multiplier: parsed.applied_peak_multiplier,
effective_rate_multiplier: parsed.effective_rate_multiplier,
observed_at: parsed.observed_at,View on GitHub (pinned to f2074595a2)
Solutions
- 根据状态码检查 API Key 与 Base URL 是否正确
- 确认上游是 sub2api 且暴露 /v1/sub2api/billing 端点
- 检查 Key 是否有计费查询权限
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/codex-plus-core/src/sub2api.rs:67 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23).
Data as JSON: /api/errors/ded8df1da524a62f.
Report an issue: GitHub.