mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
clean up legacy openai cli adapter names
This commit is contained in:
@@ -138,7 +138,7 @@ async fn gateway_admin_provider_keys_prefers_upstream_plan_type_over_auth_config
|
||||
let mut key = sample_key(
|
||||
"key-codex-oauth",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-placeholder",
|
||||
);
|
||||
key.auth_type = "oauth".to_string();
|
||||
|
||||
@@ -123,13 +123,13 @@ async fn gateway_refreshes_admin_provider_quota_locally_for_codex_with_trusted_a
|
||||
vec![sample_endpoint(
|
||||
"endpoint-codex-cli",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api",
|
||||
)],
|
||||
vec![sample_key(
|
||||
"key-codex-a",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"sk-codex-123",
|
||||
)],
|
||||
));
|
||||
@@ -306,13 +306,13 @@ async fn gateway_refreshes_admin_provider_quota_for_codex_proxy_with_extended_ti
|
||||
vec![sample_endpoint(
|
||||
"endpoint-codex-cli",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api",
|
||||
)],
|
||||
vec![sample_key(
|
||||
"key-codex-a",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"sk-codex-123",
|
||||
)],
|
||||
));
|
||||
@@ -670,13 +670,13 @@ async fn gateway_reports_codex_quota_runtime_failures_locally_without_falling_ba
|
||||
vec![sample_endpoint(
|
||||
"endpoint-codex-cli",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api",
|
||||
)],
|
||||
vec![sample_key(
|
||||
"key-codex-a",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"sk-codex-123",
|
||||
)],
|
||||
));
|
||||
|
||||
@@ -3427,14 +3427,14 @@ async fn gateway_marks_lazy_codex_oauth_refresh_failures_as_invalid() {
|
||||
let endpoint = sample_endpoint(
|
||||
"endpoint-codex-cli",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api/codex",
|
||||
);
|
||||
|
||||
let mut key = sample_key(
|
||||
"key-codex-oauth-lazy",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"stale-codex-access-token",
|
||||
);
|
||||
key.auth_type = "oauth".to_string();
|
||||
@@ -3608,14 +3608,14 @@ async fn gateway_refreshes_admin_provider_oauth_key_locally_with_trusted_admin_p
|
||||
let endpoint = sample_endpoint(
|
||||
"endpoint-codex-cli",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api/codex",
|
||||
);
|
||||
|
||||
let mut key = sample_key(
|
||||
"key-codex-oauth-refresh",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"stale-codex-access-token",
|
||||
);
|
||||
key.auth_type = "oauth".to_string();
|
||||
@@ -3902,14 +3902,14 @@ async fn gateway_marks_manual_oauth_refresh_failures_as_invalid_in_pool_payload(
|
||||
let endpoint = sample_endpoint(
|
||||
"endpoint-codex-cli",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api/codex",
|
||||
);
|
||||
|
||||
let mut key = sample_key(
|
||||
"key-codex-oauth-refresh-invalid",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"stale-codex-access-token",
|
||||
);
|
||||
key.auth_type = "oauth".to_string();
|
||||
@@ -4107,14 +4107,14 @@ async fn gateway_refreshes_admin_provider_oauth_key_locally_via_execution_runtim
|
||||
let endpoint = sample_endpoint(
|
||||
"endpoint-codex-cli",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api/codex",
|
||||
);
|
||||
|
||||
let mut key = sample_key(
|
||||
"key-codex-oauth-refresh-provider",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"stale-codex-access-token",
|
||||
);
|
||||
key.auth_type = "oauth".to_string();
|
||||
@@ -4261,14 +4261,14 @@ async fn gateway_refreshes_admin_provider_oauth_key_locally_via_execution_runtim
|
||||
let endpoint = sample_endpoint(
|
||||
"endpoint-codex-cli",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api/codex",
|
||||
);
|
||||
|
||||
let mut key = sample_key(
|
||||
"key-codex-oauth-refresh",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"stale-codex-access-token",
|
||||
);
|
||||
key.auth_type = "oauth".to_string();
|
||||
|
||||
@@ -714,7 +714,7 @@ async fn gateway_marks_account_blocked_pool_key_in_list_keys_response() {
|
||||
let mut key = sample_key(
|
||||
"key-codex-blocked",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-placeholder",
|
||||
);
|
||||
key.name = "blocked-codex".to_string();
|
||||
@@ -1349,7 +1349,7 @@ async fn gateway_formats_codex_quota_countdown_from_reset_after_seconds() {
|
||||
let mut key = sample_key(
|
||||
"key-codex-oauth",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-placeholder",
|
||||
);
|
||||
key.name = "codex quota key".to_string();
|
||||
@@ -1422,7 +1422,7 @@ async fn gateway_marks_exhausted_codex_pool_key_as_blocked_when_flag_enabled() {
|
||||
let mut key = sample_key(
|
||||
"key-codex-exhausted",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-placeholder",
|
||||
);
|
||||
key.name = "codex exhausted".to_string();
|
||||
@@ -1504,12 +1504,12 @@ async fn gateway_lists_inherited_fixed_provider_api_formats_for_pool_keys() {
|
||||
let mut key = sample_key(
|
||||
"key-codex-inherited",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-placeholder",
|
||||
);
|
||||
key.name = "codex inherited".to_string();
|
||||
key.auth_type = "oauth".to_string();
|
||||
key.api_formats = Some(json!(["openai:cli", "openai:compact"]));
|
||||
key.api_formats = Some(json!(["openai:responses", "openai:responses:compact"]));
|
||||
|
||||
let provider_catalog_repository = Arc::new(InMemoryProviderCatalogReadRepository::seed(
|
||||
vec![provider],
|
||||
@@ -1517,7 +1517,7 @@ async fn gateway_lists_inherited_fixed_provider_api_formats_for_pool_keys() {
|
||||
sample_endpoint(
|
||||
"endpoint-codex-cli",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api/codex",
|
||||
),
|
||||
sample_endpoint(
|
||||
@@ -1555,7 +1555,7 @@ async fn gateway_lists_inherited_fixed_provider_api_formats_for_pool_keys() {
|
||||
assert_eq!(keys.len(), 1);
|
||||
assert_eq!(
|
||||
keys[0]["api_formats"],
|
||||
json!(["openai:cli", "openai:image"])
|
||||
json!(["openai:image", "openai:responses"])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1582,7 +1582,7 @@ async fn gateway_prefers_status_snapshot_codex_quota_over_stale_metadata() {
|
||||
let mut key = sample_key(
|
||||
"key-codex-snapshot-fresh",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-placeholder",
|
||||
);
|
||||
key.name = "codex snapshot fresh".to_string();
|
||||
@@ -1874,7 +1874,7 @@ async fn gateway_codex_quota_resets_to_full_after_countdown_elapsed() {
|
||||
let mut key = sample_key(
|
||||
"key-codex-expired",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-placeholder",
|
||||
);
|
||||
key.name = "codex expired quota key".to_string();
|
||||
@@ -1942,7 +1942,7 @@ async fn gateway_pool_prefers_upstream_plan_type_over_auth_config() {
|
||||
let mut key = sample_key(
|
||||
"key-codex-precedence",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-placeholder",
|
||||
);
|
||||
key.auth_type = "oauth".to_string();
|
||||
@@ -2017,7 +2017,7 @@ async fn gateway_pool_plan_free_selector_prefers_upstream_plan_type() {
|
||||
let mut key = sample_key(
|
||||
"key-codex-selector",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-placeholder",
|
||||
);
|
||||
key.auth_type = "oauth".to_string();
|
||||
|
||||
@@ -359,7 +359,7 @@ async fn gateway_handles_admin_provider_query_models_respecting_key_api_formats(
|
||||
.lock()
|
||||
.expect("mutex should lock") += 1;
|
||||
assert_eq!(plan.endpoint_id, "endpoint-openai-cli");
|
||||
assert_eq!(plan.provider_api_format, "openai:cli");
|
||||
assert_eq!(plan.provider_api_format, "openai:responses");
|
||||
Json(json!({
|
||||
"request_id": "req-provider-query-cli",
|
||||
"status_code": 200,
|
||||
@@ -410,7 +410,7 @@ async fn gateway_handles_admin_provider_query_models_respecting_key_api_formats(
|
||||
StoredProviderCatalogEndpoint::new(
|
||||
"endpoint-openai-cli".to_string(),
|
||||
"provider-openai".to_string(),
|
||||
"openai:cli".to_string(),
|
||||
"openai:responses".to_string(),
|
||||
Some("cli".to_string()),
|
||||
Some("secondary".to_string()),
|
||||
true,
|
||||
@@ -431,7 +431,7 @@ async fn gateway_handles_admin_provider_query_models_respecting_key_api_formats(
|
||||
vec![sample_key(
|
||||
"key-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"sk-test-cli",
|
||||
)],
|
||||
));
|
||||
@@ -648,7 +648,7 @@ async fn gateway_handles_admin_provider_query_models_for_fixed_provider_without_
|
||||
vec![sample_key(
|
||||
"key-codex-oauth",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"sk-test-codex",
|
||||
)],
|
||||
));
|
||||
@@ -1506,7 +1506,7 @@ async fn gateway_handles_non_kiro_multi_model_failover_locally() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn gateway_handles_openai_cli_test_model_locally() {
|
||||
async fn gateway_handles_openai_responses_test_model_locally() {
|
||||
let prompt = "Tell me whether the CLI request preserved this prompt.";
|
||||
let execution_runtime = Router::new().route(
|
||||
"/v1/execute/sync",
|
||||
@@ -1514,7 +1514,7 @@ async fn gateway_handles_openai_cli_test_model_locally() {
|
||||
assert_eq!(plan.provider_id, "provider-openai");
|
||||
assert_eq!(plan.endpoint_id, "endpoint-openai-cli");
|
||||
assert_eq!(plan.key_id, "key-openai-cli");
|
||||
assert_eq!(plan.provider_api_format, "openai:cli");
|
||||
assert_eq!(plan.provider_api_format, "openai:responses");
|
||||
assert_eq!(plan.url, "https://tiger.bookapi.cc/codex/responses");
|
||||
assert!(!plan.stream);
|
||||
assert_eq!(
|
||||
@@ -1617,13 +1617,13 @@ async fn gateway_handles_openai_cli_test_model_locally() {
|
||||
vec![sample_endpoint(
|
||||
"endpoint-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://tiger.bookapi.cc/codex",
|
||||
)],
|
||||
vec![sample_key(
|
||||
"key-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"sk-test-cli",
|
||||
)],
|
||||
));
|
||||
@@ -1646,7 +1646,7 @@ async fn gateway_handles_openai_cli_test_model_locally() {
|
||||
.json(&json!({
|
||||
"provider_id": "provider-openai",
|
||||
"model": "gpt-5.4-mini",
|
||||
"api_format": "openai:cli",
|
||||
"api_format": "openai:responses",
|
||||
"message": prompt,
|
||||
"request_headers": {
|
||||
"x-stainless-runtime": "node"
|
||||
@@ -1765,7 +1765,7 @@ async fn gateway_prefers_supported_non_kiro_endpoint_when_api_format_is_omitted(
|
||||
sample_endpoint(
|
||||
"endpoint-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://api.openai.example",
|
||||
),
|
||||
sample_endpoint(
|
||||
@@ -1779,7 +1779,7 @@ async fn gateway_prefers_supported_non_kiro_endpoint_when_api_format_is_omitted(
|
||||
sample_key(
|
||||
"key-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"sk-test-cli",
|
||||
),
|
||||
sample_key(
|
||||
@@ -2028,7 +2028,7 @@ async fn gateway_uses_compatible_cli_endpoint_when_api_format_is_omitted() {
|
||||
"/v1/execute/sync",
|
||||
any(move |Json(plan): Json<ExecutionPlan>| async move {
|
||||
assert_eq!(plan.endpoint_id, "endpoint-openai-cli");
|
||||
assert_eq!(plan.provider_api_format, "openai:cli");
|
||||
assert_eq!(plan.provider_api_format, "openai:responses");
|
||||
assert_eq!(plan.key_id, "key-openai-cli");
|
||||
Json(json!({
|
||||
"request_id": plan.request_id,
|
||||
@@ -2070,14 +2070,14 @@ async fn gateway_uses_compatible_cli_endpoint_when_api_format_is_omitted() {
|
||||
sample_endpoint(
|
||||
"endpoint-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://api.openai.example",
|
||||
),
|
||||
],
|
||||
vec![sample_key(
|
||||
"key-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"sk-test-cli",
|
||||
)],
|
||||
));
|
||||
@@ -2123,7 +2123,7 @@ async fn gateway_uses_runnable_cli_endpoint_after_chat_preference_when_api_forma
|
||||
"/v1/execute/sync",
|
||||
any(move |Json(plan): Json<ExecutionPlan>| async move {
|
||||
assert_eq!(plan.endpoint_id, "endpoint-openai-cli-runnable");
|
||||
assert_eq!(plan.provider_api_format, "openai:cli");
|
||||
assert_eq!(plan.provider_api_format, "openai:responses");
|
||||
assert_eq!(plan.key_id, "key-openai-shared");
|
||||
Json(json!({
|
||||
"request_id": plan.request_id,
|
||||
@@ -2163,7 +2163,7 @@ async fn gateway_uses_runnable_cli_endpoint_after_chat_preference_when_api_forma
|
||||
let cli_endpoint = sample_endpoint(
|
||||
"endpoint-openai-cli-runnable",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://api.openai.example",
|
||||
);
|
||||
let mut shared_key = sample_key(
|
||||
@@ -2172,7 +2172,7 @@ async fn gateway_uses_runnable_cli_endpoint_after_chat_preference_when_api_forma
|
||||
"openai:chat",
|
||||
"sk-test-shared",
|
||||
);
|
||||
shared_key.api_formats = Some(json!(["openai:chat", "openai:cli"]));
|
||||
shared_key.api_formats = Some(json!(["openai:chat", "openai:responses"]));
|
||||
let provider_catalog_repository = Arc::new(InMemoryProviderCatalogReadRepository::seed(
|
||||
vec![provider],
|
||||
vec![unsupported_chat_endpoint, cli_endpoint],
|
||||
@@ -2215,14 +2215,14 @@ async fn gateway_uses_runnable_cli_endpoint_after_chat_preference_when_api_forma
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn gateway_handles_openai_cli_test_model_failover_locally() {
|
||||
async fn gateway_handles_openai_responses_test_model_failover_locally() {
|
||||
let execution_runtime = Router::new().route(
|
||||
"/v1/execute/sync",
|
||||
any(move |Json(plan): Json<ExecutionPlan>| async move {
|
||||
assert_eq!(plan.provider_id, "provider-openai");
|
||||
assert_eq!(plan.endpoint_id, "endpoint-openai-cli");
|
||||
assert_eq!(plan.key_id, "key-openai-cli");
|
||||
assert_eq!(plan.provider_api_format, "openai:cli");
|
||||
assert_eq!(plan.provider_api_format, "openai:responses");
|
||||
assert_eq!(plan.model_name.as_deref(), Some("gpt-5.4-mini"));
|
||||
Json(json!({
|
||||
"request_id": plan.request_id,
|
||||
@@ -2257,13 +2257,13 @@ async fn gateway_handles_openai_cli_test_model_failover_locally() {
|
||||
vec![sample_endpoint(
|
||||
"endpoint-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://api.openai.example",
|
||||
)],
|
||||
vec![sample_key(
|
||||
"key-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"sk-test-cli",
|
||||
)],
|
||||
));
|
||||
@@ -2288,7 +2288,7 @@ async fn gateway_handles_openai_cli_test_model_failover_locally() {
|
||||
.json(&json!({
|
||||
"provider_id": "provider-openai",
|
||||
"failover_models": ["gpt-5.4-mini"],
|
||||
"api_format": "openai:cli"
|
||||
"api_format": "openai:responses"
|
||||
}))
|
||||
.send()
|
||||
.await
|
||||
|
||||
@@ -255,7 +255,7 @@ async fn gateway_handles_admin_provider_summary_locally_with_trusted_admin_princ
|
||||
sample_endpoint(
|
||||
"endpoint-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://api.openai.example",
|
||||
),
|
||||
],
|
||||
@@ -270,11 +270,11 @@ async fn gateway_handles_admin_provider_summary_locally_with_trusted_admin_princ
|
||||
sample_key(
|
||||
"key-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"sk-test-cli",
|
||||
)
|
||||
.with_transport_fields(
|
||||
Some(json!(["openai:cli"])),
|
||||
Some(json!(["openai:responses"])),
|
||||
encrypt_python_fernet_plaintext(DEVELOPMENT_ENCRYPTION_KEY, "sk-test-cli-2")
|
||||
.expect("api key ciphertext should build"),
|
||||
None,
|
||||
@@ -286,7 +286,10 @@ async fn gateway_handles_admin_provider_summary_locally_with_trusted_admin_princ
|
||||
None,
|
||||
)
|
||||
.expect("key transport should build")
|
||||
.with_health_fields(Some(json!({"openai:cli": {"health_score": 0.75}})), None),
|
||||
.with_health_fields(
|
||||
Some(json!({"openai:responses": {"health_score": 0.75}})),
|
||||
None,
|
||||
),
|
||||
],
|
||||
));
|
||||
let global_model_repository = Arc::new(
|
||||
@@ -342,7 +345,10 @@ async fn gateway_handles_admin_provider_summary_locally_with_trusted_admin_princ
|
||||
assert_eq!(payload["total_models"], 5);
|
||||
assert_eq!(payload["active_models"], 3);
|
||||
assert_eq!(payload["global_model_ids"], json!(["gpt-5", "gpt-5-mini"]));
|
||||
assert_eq!(payload["api_formats"], json!(["openai:chat", "openai:cli"]));
|
||||
assert_eq!(
|
||||
payload["api_formats"],
|
||||
json!(["openai:chat", "openai:responses"])
|
||||
);
|
||||
assert_eq!(payload["ops_configured"], true);
|
||||
assert_eq!(payload["ops_architecture_id"], "anyrouter");
|
||||
assert_eq!(payload["created_at"], "2024-03-21T05:46:40Z");
|
||||
@@ -358,7 +364,7 @@ async fn gateway_handles_admin_provider_summary_locally_with_trusted_admin_princ
|
||||
"active_keys": 1
|
||||
},
|
||||
{
|
||||
"api_format": "openai:cli",
|
||||
"api_format": "openai:responses",
|
||||
"health_score": 0.75,
|
||||
"is_active": true,
|
||||
"total_keys": 1,
|
||||
@@ -1025,7 +1031,7 @@ async fn gateway_updates_fixed_provider_and_reconciles_template_managed_endpoint
|
||||
let mut cli_endpoint = sample_endpoint(
|
||||
"endpoint-codex-cli",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api/codex",
|
||||
);
|
||||
cli_endpoint.max_retries = Some(2);
|
||||
@@ -1033,11 +1039,11 @@ async fn gateway_updates_fixed_provider_and_reconciles_template_managed_endpoint
|
||||
let mut key = sample_key(
|
||||
"key-codex-oauth",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-placeholder",
|
||||
);
|
||||
key.auth_type = "oauth".to_string();
|
||||
key.api_formats = Some(json!(["openai:cli"]));
|
||||
key.api_formats = Some(json!(["openai:responses"]));
|
||||
|
||||
let provider_catalog_repository = Arc::new(InMemoryProviderCatalogReadRepository::seed(
|
||||
vec![provider],
|
||||
@@ -1133,12 +1139,12 @@ async fn gateway_lists_effective_api_formats_for_fixed_oauth_provider_keys() {
|
||||
let mut key = sample_key(
|
||||
"key-codex-legacy",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-placeholder",
|
||||
);
|
||||
key.name = "codex legacy".to_string();
|
||||
key.auth_type = "oauth".to_string();
|
||||
key.api_formats = Some(json!(["openai:cli", "openai:compact"]));
|
||||
key.api_formats = Some(json!(["openai:responses", "openai:responses:compact"]));
|
||||
|
||||
let provider_catalog_repository = Arc::new(InMemoryProviderCatalogReadRepository::seed(
|
||||
vec![provider],
|
||||
@@ -1146,7 +1152,7 @@ async fn gateway_lists_effective_api_formats_for_fixed_oauth_provider_keys() {
|
||||
sample_endpoint(
|
||||
"endpoint-codex-cli",
|
||||
"provider-codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api/codex",
|
||||
),
|
||||
sample_endpoint(
|
||||
@@ -1186,7 +1192,7 @@ async fn gateway_lists_effective_api_formats_for_fixed_oauth_provider_keys() {
|
||||
assert_eq!(keys.len(), 1);
|
||||
assert_eq!(
|
||||
keys[0]["api_formats"],
|
||||
json!(["openai:cli", "openai:image"])
|
||||
json!(["openai:image", "openai:responses"])
|
||||
);
|
||||
|
||||
gateway_handle.abort();
|
||||
@@ -1219,7 +1225,7 @@ async fn gateway_handles_admin_provider_health_monitor_locally_with_trusted_admi
|
||||
sample_endpoint(
|
||||
"endpoint-openai-cli",
|
||||
"provider-openai",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://api.openai.example",
|
||||
),
|
||||
],
|
||||
@@ -1311,7 +1317,7 @@ async fn gateway_handles_admin_provider_health_monitor_locally_with_trusted_admi
|
||||
.as_str()
|
||||
.is_some_and(|value| value.ends_with(".000Z")));
|
||||
assert_eq!(endpoints[1]["endpoint_id"], "endpoint-openai-cli");
|
||||
assert_eq!(endpoints[1]["api_format"], "openai:cli");
|
||||
assert_eq!(endpoints[1]["api_format"], "openai:responses");
|
||||
assert_eq!(endpoints[1]["total_attempts"], 1);
|
||||
assert_eq!(endpoints[1]["success_count"], 0);
|
||||
assert_eq!(endpoints[1]["failed_count"], 0);
|
||||
|
||||
@@ -446,7 +446,7 @@ async fn gateway_handles_admin_system_config_export_locally_with_trusted_admin_p
|
||||
sample_endpoint(
|
||||
"endpoint-cli",
|
||||
&provider_id,
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://api.openai.example",
|
||||
),
|
||||
],
|
||||
|
||||
@@ -190,7 +190,7 @@ fn sample_oauth_system_import_payload(access_token: &str, refresh_token: &str) -
|
||||
"website": "https://example.com",
|
||||
"is_active": true,
|
||||
"endpoints": [{
|
||||
"api_format": "openai:cli",
|
||||
"api_format": "openai:responses",
|
||||
"base_url": "https://chatgpt.com",
|
||||
"is_active": true
|
||||
}],
|
||||
@@ -202,7 +202,7 @@ fn sample_oauth_system_import_payload(access_token: &str, refresh_token: &str) -
|
||||
"{{\"provider_type\":\"codex\",\"refresh_token\":\"{}\",\"email\":\"alice@example.com\",\"account_id\":\"acct-codex-123\",\"plan_type\":\"plus\"}}",
|
||||
refresh_token
|
||||
),
|
||||
"api_formats": ["openai:cli"],
|
||||
"api_formats": ["openai:responses"],
|
||||
"is_active": true
|
||||
}],
|
||||
"models": []
|
||||
@@ -1170,13 +1170,13 @@ async fn gateway_overwrites_oauth_provider_key_credentials_from_admin_system_imp
|
||||
let endpoint = sample_endpoint(
|
||||
"endpoint-codex-existing",
|
||||
"provider-codex-existing",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"https://chatgpt.com/backend-api/codex",
|
||||
);
|
||||
let mut existing_key = sample_key(
|
||||
"key-codex-existing",
|
||||
"provider-codex-existing",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"oauth-access-token-old",
|
||||
);
|
||||
existing_key.name = "oauth-primary".to_string();
|
||||
|
||||
Reference in New Issue
Block a user