Treat ChatGPT hc plan as Enterprise (#15789)

This commit is contained in:
arnavdugar-openai
2026-03-25 15:41:29 -07:00
committed by GitHub
parent b6524514c1
commit eee692e351
3 changed files with 45 additions and 1 deletions
+2 -1
View File
@@ -72,7 +72,7 @@ impl PlanType {
"pro" => Self::Known(KnownPlan::Pro),
"team" => Self::Known(KnownPlan::Team),
"business" => Self::Known(KnownPlan::Business),
"enterprise" => Self::Known(KnownPlan::Enterprise),
"enterprise" | "hc" => Self::Known(KnownPlan::Enterprise),
"education" | "edu" => Self::Known(KnownPlan::Edu),
_ => Self::Unknown(raw.to_string()),
}
@@ -88,6 +88,7 @@ pub enum KnownPlan {
Pro,
Team,
Business,
#[serde(alias = "hc")]
Enterprise,
Edu,
}
+15
View File
@@ -53,6 +53,21 @@ fn id_token_info_parses_go_plan() {
assert_eq!(info.get_chatgpt_plan_type().as_deref(), Some("Go"));
}
#[test]
fn id_token_info_parses_hc_plan_as_enterprise() {
let fake_jwt = fake_jwt(serde_json::json!({
"email": "user@example.com",
"https://api.openai.com/auth": {
"chatgpt_plan_type": "hc"
}
}));
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("Enterprise"));
assert_eq!(info.is_workspace_account(), true);
}
#[test]
fn id_token_info_handles_missing_fields() {
let fake_jwt = fake_jwt(serde_json::json!({ "sub": "123" }));