fix: use codex quota refresh for account checks

This commit is contained in:
fawney19
2026-05-16 20:16:23 +08:00
parent 56994d4c29
commit 3a5922d4ee
16 changed files with 150 additions and 144 deletions

View File

@@ -15,8 +15,7 @@ use crate::quota::{
};
use crate::quota_refresh::ProviderPoolQuotaRequestSpec;
pub const CODEX_BACKEND_ME_URL: &str = "https://chatgpt.com/backend-api/me";
pub const CODEX_WHAM_USAGE_URL: &str = CODEX_BACKEND_ME_URL;
pub const CODEX_WHAM_USAGE_URL: &str = "https://chatgpt.com/backend-api/wham/usage";
const PLACEHOLDER_API_KEY: &str = "__placeholder__";
#[derive(Debug, Clone, Default)]
@@ -111,13 +110,13 @@ pub fn build_codex_pool_quota_request(
provider_name: "codex".to_string(),
quota_kind: "codex".to_string(),
method: "GET".to_string(),
url: CODEX_BACKEND_ME_URL.to_string(),
url: CODEX_WHAM_USAGE_URL.to_string(),
headers,
content_type: None,
json_body: None,
client_api_format: "openai:responses".to_string(),
provider_api_format: "openai:responses".to_string(),
model_name: Some("codex-backend-me".to_string()),
model_name: Some("codex-wham-usage".to_string()),
accept_invalid_certs: false,
})
}

View File

@@ -16,7 +16,7 @@ pub use chatgpt_web::{
CHATGPT_WEB_DEFAULT_BASE_URL,
};
pub use codex::CodexProviderPoolAdapter;
pub use codex::{build_codex_pool_quota_request, CODEX_BACKEND_ME_URL, CODEX_WHAM_USAGE_URL};
pub use codex::{build_codex_pool_quota_request, CODEX_WHAM_USAGE_URL};
pub use default::DefaultProviderPoolAdapter;
pub use kiro::KiroProviderPoolAdapter;
pub use kiro::{