mirror of
https://github.com/openai/codex.git
synced 2026-11-29 00:00:54 +00:00
Add Pro Max plan support and update Pro display names (#47971)
## What changed - Recognize `promax` in authentication, account responses, and backend rate limits; update generated schemas and client types. - Display `prolite` as “Pro”, `pro` as “Pro (More)”, and `promax` as “Pro (Max)” in account labels, status, and analytics. - Include Pro Max in experimental context eligibility, paid-plan tooltips, and usage-limit guidance for purchasing credits. ## Testing Extend coverage for Pro Max plan parsing, account and rate-limit responses, experimental context eligibility, and plan display names. Update the login token test to expect “Pro (More)”. GitOrigin-RevId: 197e00fa7a99cbce125c8f1d43a451ec1ed5c1fb
This commit is contained in:
@@ -3327,6 +3327,7 @@
|
||||
"plus",
|
||||
"pro",
|
||||
"prolite",
|
||||
"promax",
|
||||
"team",
|
||||
"self_serve_business_prolite",
|
||||
"self_serve_business_usage_based",
|
||||
|
||||
+1
@@ -16235,6 +16235,7 @@
|
||||
"plus",
|
||||
"pro",
|
||||
"prolite",
|
||||
"promax",
|
||||
"team",
|
||||
"self_serve_business_prolite",
|
||||
"self_serve_business_usage_based",
|
||||
|
||||
+1
@@ -12267,6 +12267,7 @@
|
||||
"plus",
|
||||
"pro",
|
||||
"prolite",
|
||||
"promax",
|
||||
"team",
|
||||
"self_serve_business_prolite",
|
||||
"self_serve_business_usage_based",
|
||||
|
||||
+1
@@ -29,6 +29,7 @@
|
||||
"plus",
|
||||
"pro",
|
||||
"prolite",
|
||||
"promax",
|
||||
"team",
|
||||
"self_serve_business_prolite",
|
||||
"self_serve_business_usage_based",
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"plus",
|
||||
"pro",
|
||||
"prolite",
|
||||
"promax",
|
||||
"team",
|
||||
"self_serve_business_prolite",
|
||||
"self_serve_business_usage_based",
|
||||
|
||||
+1
@@ -29,6 +29,7 @@
|
||||
"plus",
|
||||
"pro",
|
||||
"prolite",
|
||||
"promax",
|
||||
"team",
|
||||
"self_serve_business_prolite",
|
||||
"self_serve_business_usage_based",
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
"plus",
|
||||
"pro",
|
||||
"prolite",
|
||||
"promax",
|
||||
"team",
|
||||
"self_serve_business_prolite",
|
||||
"self_serve_business_usage_based",
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
-1
@@ -2,4 +2,4 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type PlanType = "free" | "go" | "plus" | "pro" | "prolite" | "team" | "self_serve_business_prolite" | "self_serve_business_usage_based" | "business" | "ent26" | "enterprise_cbp_automation" | "enterprise_cbp_usage_based" | "enterprise" | "edu" | "edu_plus" | "edu_pro" | "unknown";
|
||||
export type PlanType = "free" | "go" | "plus" | "pro" | "prolite" | "promax" | "team" | "self_serve_business_prolite" | "self_serve_business_usage_based" | "business" | "ent26" | "enterprise_cbp_automation" | "enterprise_cbp_usage_based" | "enterprise" | "edu" | "edu_plus" | "edu_pro" | "unknown";
|
||||
|
||||
@@ -3279,6 +3279,7 @@ async fn get_account_with_chatgpt() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test_case("promax", AccountPlanType::ProMax; "pro_max")]
|
||||
#[test_case("self_serve_business_prolite", AccountPlanType::SelfServeBusinessProLite; "business_prolite")]
|
||||
#[test_case("edu_plus", AccountPlanType::EduPlus; "edu_plus")]
|
||||
#[test_case("edu_pro", AccountPlanType::EduPro; "edu_pro")]
|
||||
|
||||
@@ -98,6 +98,7 @@ async fn get_account_rate_limits_requires_chatgpt_auth() -> Result<()> {
|
||||
}
|
||||
|
||||
#[test_case("enterprise_cbp_automation", AccountPlanType::EnterpriseCbpAutomation; "enterprise_automation")]
|
||||
#[test_case("promax", AccountPlanType::ProMax; "pro_max")]
|
||||
#[test_case("edu_plus", AccountPlanType::EduPlus; "edu_plus")]
|
||||
#[test_case("edu_pro", AccountPlanType::EduPro; "edu_pro")]
|
||||
#[tokio::test]
|
||||
|
||||
@@ -781,6 +781,7 @@ impl Client {
|
||||
crate::types::PlanType::Plus => AccountPlanType::Plus,
|
||||
crate::types::PlanType::Pro => AccountPlanType::Pro,
|
||||
crate::types::PlanType::ProLite => AccountPlanType::ProLite,
|
||||
crate::types::PlanType::ProMax => AccountPlanType::ProMax,
|
||||
crate::types::PlanType::Team => AccountPlanType::Team,
|
||||
crate::types::PlanType::SelfServeBusinessProLite => {
|
||||
AccountPlanType::SelfServeBusinessProLite
|
||||
|
||||
@@ -108,6 +108,8 @@ pub enum PlanType {
|
||||
Pro,
|
||||
#[serde(rename = "prolite")]
|
||||
ProLite,
|
||||
#[serde(rename = "promax")]
|
||||
ProMax,
|
||||
#[serde(rename = "free_workspace")]
|
||||
FreeWorkspace,
|
||||
#[serde(rename = "team")]
|
||||
|
||||
@@ -14,7 +14,7 @@ fn experimental_context_is_eligible(auth_mode: AuthMode, plan_type: Option<PlanT
|
||||
auth_mode == AuthMode::Chatgpt
|
||||
&& matches!(
|
||||
plan_type,
|
||||
Some(PlanType::Plus | PlanType::Pro | PlanType::ProLite)
|
||||
Some(PlanType::Plus | PlanType::Pro | PlanType::ProLite | PlanType::ProMax)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -235,6 +235,7 @@ mod tests {
|
||||
(AuthMode::Chatgpt, PlanType::Plus, true),
|
||||
(AuthMode::Chatgpt, PlanType::Pro, true),
|
||||
(AuthMode::Chatgpt, PlanType::ProLite, true),
|
||||
(AuthMode::Chatgpt, PlanType::ProMax, true),
|
||||
(AuthMode::Chatgpt, PlanType::Free, false),
|
||||
(AuthMode::Chatgpt, PlanType::Enterprise, false),
|
||||
(AuthMode::ApiKey, PlanType::Pro, false),
|
||||
|
||||
@@ -37,7 +37,7 @@ fn id_token_info_parses_email_and_plan() {
|
||||
|
||||
let info = parse_chatgpt_jwt_claims(&fake_jwt).expect("should parse");
|
||||
assert_eq!(info.email.as_deref(), Some("user@example.com"));
|
||||
assert_eq!(info.get_chatgpt_plan_type().as_deref(), Some("Pro"));
|
||||
assert_eq!(info.get_chatgpt_plan_type().as_deref(), Some("Pro (More)"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -16,6 +16,7 @@ pub enum PlanType {
|
||||
Plus,
|
||||
Pro,
|
||||
ProLite,
|
||||
ProMax,
|
||||
Team,
|
||||
#[serde(rename = "self_serve_business_prolite")]
|
||||
#[ts(rename = "self_serve_business_prolite")]
|
||||
@@ -104,6 +105,7 @@ impl From<KnownPlan> for PlanType {
|
||||
KnownPlan::Plus => Self::Plus,
|
||||
KnownPlan::Pro => Self::Pro,
|
||||
KnownPlan::ProLite => Self::ProLite,
|
||||
KnownPlan::ProMax => Self::ProMax,
|
||||
KnownPlan::Team => Self::Team,
|
||||
KnownPlan::SelfServeBusinessProLite => Self::SelfServeBusinessProLite,
|
||||
KnownPlan::SelfServeBusinessUsageBased => Self::SelfServeBusinessUsageBased,
|
||||
|
||||
@@ -78,6 +78,7 @@ impl PlanType {
|
||||
"plus" => Self::Known(KnownPlan::Plus),
|
||||
"pro" => Self::Known(KnownPlan::Pro),
|
||||
"prolite" => Self::Known(KnownPlan::ProLite),
|
||||
"promax" => Self::Known(KnownPlan::ProMax),
|
||||
"team" => Self::Known(KnownPlan::Team),
|
||||
"self_serve_business_prolite" => Self::Known(KnownPlan::SelfServeBusinessProLite),
|
||||
"self_serve_business_usage_based" => {
|
||||
@@ -104,6 +105,7 @@ pub enum KnownPlan {
|
||||
Plus,
|
||||
Pro,
|
||||
ProLite,
|
||||
ProMax,
|
||||
Team,
|
||||
#[serde(rename = "self_serve_business_prolite")]
|
||||
SelfServeBusinessProLite,
|
||||
@@ -131,8 +133,9 @@ impl KnownPlan {
|
||||
Self::Free => "Free",
|
||||
Self::Go => "Go",
|
||||
Self::Plus => "Plus",
|
||||
Self::Pro => "Pro",
|
||||
Self::ProLite => "Pro Lite",
|
||||
Self::Pro => "Pro (More)",
|
||||
Self::ProLite => "Pro",
|
||||
Self::ProMax => "Pro (Max)",
|
||||
Self::Team => "Team",
|
||||
Self::SelfServeBusinessProLite => "Self Serve Business ProLite",
|
||||
Self::SelfServeBusinessUsageBased => "Self Serve Business Usage Based",
|
||||
@@ -154,6 +157,7 @@ impl KnownPlan {
|
||||
Self::Plus => "plus",
|
||||
Self::Pro => "pro",
|
||||
Self::ProLite => "prolite",
|
||||
Self::ProMax => "promax",
|
||||
Self::Team => "team",
|
||||
Self::SelfServeBusinessProLite => "self_serve_business_prolite",
|
||||
Self::SelfServeBusinessUsageBased => "self_serve_business_usage_based",
|
||||
@@ -233,6 +237,7 @@ mod tests {
|
||||
PlanType::Known(KnownPlan::EnterpriseCbpAutomation)
|
||||
);
|
||||
for (raw, known) in [
|
||||
("promax", KnownPlan::ProMax),
|
||||
("edu_plus", KnownPlan::EduPlus),
|
||||
("edu_pro", KnownPlan::EduPro),
|
||||
] {
|
||||
|
||||
@@ -766,10 +766,12 @@ impl std::fmt::Display for UsageLimitReachedError {
|
||||
retry_suffix_after_or(self.resets_at.as_ref())
|
||||
)
|
||||
}
|
||||
Some(PlanType::Known(KnownPlan::Pro | KnownPlan::ProLite)) => format!(
|
||||
"You’ve hit your usage limit. Visit https://chatgpt.com/codex/settings/usage to purchase more credits{}",
|
||||
retry_suffix_after_or(self.resets_at.as_ref())
|
||||
),
|
||||
Some(PlanType::Known(KnownPlan::Pro | KnownPlan::ProLite | KnownPlan::ProMax)) => {
|
||||
format!(
|
||||
"You’ve hit your usage limit. Visit https://chatgpt.com/codex/settings/usage to purchase more credits{}",
|
||||
retry_suffix_after_or(self.resets_at.as_ref())
|
||||
)
|
||||
}
|
||||
Some(PlanType::Known(
|
||||
KnownPlan::Enterprise | KnownPlan::Edu | KnownPlan::EduPlus | KnownPlan::EduPro,
|
||||
)) => format!(
|
||||
|
||||
@@ -108,8 +108,9 @@ impl AnalyticsView {
|
||||
PlanType::Free => "Free",
|
||||
PlanType::Go => "Go",
|
||||
PlanType::Plus => "Plus",
|
||||
PlanType::Pro => "Pro",
|
||||
PlanType::ProLite => "Pro Lite",
|
||||
PlanType::Pro => "Pro (More)",
|
||||
PlanType::ProLite => "Pro",
|
||||
PlanType::ProMax => "Pro (Max)",
|
||||
PlanType::Team
|
||||
| PlanType::Business
|
||||
| PlanType::SelfServeBusinessProLite
|
||||
|
||||
@@ -62,8 +62,9 @@ impl AnalyticsView {
|
||||
PlanType::Free => "Free",
|
||||
PlanType::Go => "Go",
|
||||
PlanType::Plus => "Plus",
|
||||
PlanType::Pro => "Pro",
|
||||
PlanType::ProLite => "Pro Lite",
|
||||
PlanType::Pro => "Pro (More)",
|
||||
PlanType::ProLite => "Pro",
|
||||
PlanType::ProMax => "Pro (Max)",
|
||||
PlanType::Team
|
||||
| PlanType::Business
|
||||
| PlanType::SelfServeBusinessProLite
|
||||
|
||||
@@ -106,8 +106,12 @@ pub(crate) fn plan_type_display_name(plan_type: PlanType) -> String {
|
||||
"Business".to_string()
|
||||
} else if plan_type.is_business_like() {
|
||||
"Enterprise".to_string()
|
||||
} else if plan_type == PlanType::Pro {
|
||||
"Pro (More)".to_string()
|
||||
} else if plan_type == PlanType::ProMax {
|
||||
"Pro (Max)".to_string()
|
||||
} else if plan_type == PlanType::ProLite {
|
||||
"Pro Lite".to_string()
|
||||
"Pro".to_string()
|
||||
} else if plan_type == PlanType::EduPlus {
|
||||
"Edu Plus".to_string()
|
||||
} else if plan_type == PlanType::EduPro {
|
||||
@@ -229,8 +233,9 @@ mod tests {
|
||||
(PlanType::Free, "Free"),
|
||||
(PlanType::Go, "Go"),
|
||||
(PlanType::Plus, "Plus"),
|
||||
(PlanType::Pro, "Pro"),
|
||||
(PlanType::ProLite, "Pro Lite"),
|
||||
(PlanType::Pro, "Pro (More)"),
|
||||
(PlanType::ProLite, "Pro"),
|
||||
(PlanType::ProMax, "Pro (Max)"),
|
||||
(PlanType::Team, "Business"),
|
||||
(PlanType::SelfServeBusinessUsageBased, "Business"),
|
||||
(PlanType::Business, "Enterprise"),
|
||||
|
||||
@@ -94,7 +94,11 @@ pub(crate) fn preferred_tooltip<R: Rng + ?Sized>(
|
||||
Some(plan_type)
|
||||
if matches!(
|
||||
plan_type,
|
||||
PlanType::Plus | PlanType::Enterprise | PlanType::Pro | PlanType::ProLite
|
||||
PlanType::Plus
|
||||
| PlanType::Enterprise
|
||||
| PlanType::Pro
|
||||
| PlanType::ProLite
|
||||
| PlanType::ProMax
|
||||
) || plan_type.is_team_like()
|
||||
|| plan_type.is_business_like() =>
|
||||
{
|
||||
|
||||
@@ -3096,6 +3096,7 @@ class PlanType(str, Enum):
|
||||
plus = "plus"
|
||||
pro = "pro"
|
||||
prolite = "prolite"
|
||||
promax = "promax"
|
||||
team = "team"
|
||||
self_serve_business_prolite = "self_serve_business_prolite"
|
||||
self_serve_business_usage_based = "self_serve_business_usage_based"
|
||||
|
||||
Reference in New Issue
Block a user