Normalize canonical API formats

This commit is contained in:
fawney19
2026-04-29 10:20:41 +08:00
parent 02ad67fe33
commit 07a319259b
171 changed files with 2460 additions and 1962 deletions
@@ -101,7 +101,7 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
true,
false,
Some(serde_json::json!(["claude", "kiro"])),
Some(serde_json::json!(["claude:cli"])),
Some(serde_json::json!(["claude:messages"])),
Some(serde_json::json!(["claude-sonnet-4"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -112,7 +112,7 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
Some(5),
Some(4_102_444_800),
Some(serde_json::json!(["claude", "kiro"])),
Some(serde_json::json!(["claude:cli"])),
Some(serde_json::json!(["claude:messages"])),
Some(serde_json::json!(["claude-sonnet-4"])),
)
.expect("auth snapshot should build")
@@ -126,7 +126,7 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-kiro-cli-local-stream-1".to_string(),
endpoint_api_format: "claude:cli".to_string(),
endpoint_api_format: "claude:messages".to_string(),
endpoint_api_family: Some("claude".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -134,11 +134,11 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
key_name: "prod".to_string(),
key_auth_type: "bearer".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["claude:cli".to_string()]),
key_api_formats: Some(vec!["claude:messages".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"claude:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"claude:messages": 1})),
model_id: "model-kiro-cli-local-stream-1".to_string(),
global_model_id: "global-model-kiro-cli-local-stream-1".to_string(),
global_model_name: "claude-sonnet-4".to_string(),
@@ -148,7 +148,7 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "claude-sonnet-4-upstream".to_string(),
priority: 1,
api_formats: Some(vec!["claude:cli".to_string()]),
api_formats: Some(vec!["claude:messages".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -181,7 +181,7 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
StoredProviderCatalogEndpoint::new(
"endpoint-kiro-cli-local-stream-1".to_string(),
"provider-kiro-cli-local-stream-1".to_string(),
"claude:cli".to_string(),
"claude:messages".to_string(),
Some("claude".to_string()),
Some("cli".to_string()),
true,
@@ -228,7 +228,7 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["claude:cli"])),
Some(serde_json::json!(["claude:messages"])),
encrypt_python_fernet_plaintext(DEVELOPMENT_ENCRYPTION_KEY, "__placeholder__")
.expect("api key should encrypt"),
Some(
@@ -239,7 +239,7 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
.expect("auth config should encrypt"),
),
None,
Some(serde_json::json!({"claude:cli": 1})),
Some(serde_json::json!({"claude:messages": 1})),
None,
None,
Some(
@@ -270,7 +270,7 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
"route_class": "ai_public",
"route_family": "claude",
"route_kind": "cli",
"auth_endpoint_signature": "claude:cli",
"auth_endpoint_signature": "claude:messages",
"execution_runtime_candidate": true,
"auth_context": {
"user_id": "user-kiro-cli-local-stream-123",
@@ -606,7 +606,7 @@ async fn gateway_executes_claude_cli_stream_via_local_decision_gate_without_wait
true,
false,
Some(serde_json::json!(["claude"])),
Some(serde_json::json!(["claude:cli"])),
Some(serde_json::json!(["claude:messages"])),
Some(serde_json::json!(["claude-code"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -617,7 +617,7 @@ async fn gateway_executes_claude_cli_stream_via_local_decision_gate_without_wait
Some(5),
Some(4_102_444_800),
Some(serde_json::json!(["claude"])),
Some(serde_json::json!(["claude:cli"])),
Some(serde_json::json!(["claude:messages"])),
Some(serde_json::json!(["claude-code"])),
)
.expect("auth snapshot should build")
@@ -631,7 +631,7 @@ async fn gateway_executes_claude_cli_stream_via_local_decision_gate_without_wait
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-claude-cli-local-1".to_string(),
endpoint_api_format: "claude:cli".to_string(),
endpoint_api_format: "claude:messages".to_string(),
endpoint_api_family: Some("claude".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -639,11 +639,11 @@ async fn gateway_executes_claude_cli_stream_via_local_decision_gate_without_wait
key_name: "prod".to_string(),
key_auth_type: "bearer".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["claude:cli".to_string()]),
key_api_formats: Some(vec!["claude:messages".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"claude:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"claude:messages": 1})),
model_id: "model-claude-cli-local-1".to_string(),
global_model_id: "global-model-claude-cli-local-1".to_string(),
global_model_name: "claude-code".to_string(),
@@ -653,7 +653,7 @@ async fn gateway_executes_claude_cli_stream_via_local_decision_gate_without_wait
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "claude-code-upstream".to_string(),
priority: 1,
api_formats: Some(vec!["claude:cli".to_string()]),
api_formats: Some(vec!["claude:messages".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -686,7 +686,7 @@ async fn gateway_executes_claude_cli_stream_via_local_decision_gate_without_wait
StoredProviderCatalogEndpoint::new(
"endpoint-claude-cli-local-1".to_string(),
"provider-claude-cli-local-1".to_string(),
"claude:cli".to_string(),
"claude:messages".to_string(),
Some("claude".to_string()),
Some("cli".to_string()),
true,
@@ -721,12 +721,12 @@ async fn gateway_executes_claude_cli_stream_via_local_decision_gate_without_wait
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["claude:cli"])),
Some(serde_json::json!(["claude:messages"])),
encrypt_python_fernet_plaintext(DEVELOPMENT_ENCRYPTION_KEY, "sk-upstream-claude-cli")
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"claude:cli": 1})),
Some(serde_json::json!({"claude:messages": 1})),
None,
None,
Some(serde_json::json!({"enabled": true, "node_id":"proxy-node-claude-cli-local"})),
@@ -1055,7 +1055,7 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
true,
false,
Some(serde_json::json!(["claude", "claude_code"])),
Some(serde_json::json!(["claude:cli"])),
Some(serde_json::json!(["claude:messages"])),
Some(serde_json::json!(["claude-code"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -1066,7 +1066,7 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
Some(5),
Some(4_102_444_800),
Some(serde_json::json!(["claude", "claude_code"])),
Some(serde_json::json!(["claude:cli"])),
Some(serde_json::json!(["claude:messages"])),
Some(serde_json::json!(["claude-code"])),
)
.expect("auth snapshot should build")
@@ -1080,7 +1080,7 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-claude-code-cli-local-1".to_string(),
endpoint_api_format: "claude:cli".to_string(),
endpoint_api_format: "claude:messages".to_string(),
endpoint_api_family: Some("claude".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -1088,11 +1088,11 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
key_name: "prod".to_string(),
key_auth_type: "oauth".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["claude:cli".to_string()]),
key_api_formats: Some(vec!["claude:messages".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"claude:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"claude:messages": 1})),
model_id: "model-claude-code-cli-local-1".to_string(),
global_model_id: "global-model-claude-code-cli-local-1".to_string(),
global_model_name: "claude-code".to_string(),
@@ -1102,7 +1102,7 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "claude-code-upstream".to_string(),
priority: 1,
api_formats: Some(vec!["claude:cli".to_string()]),
api_formats: Some(vec!["claude:messages".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -1139,7 +1139,7 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
StoredProviderCatalogEndpoint::new(
"endpoint-claude-code-cli-local-1".to_string(),
"provider-claude-code-cli-local-1".to_string(),
"claude:cli".to_string(),
"claude:messages".to_string(),
Some("claude".to_string()),
Some("cli".to_string()),
true,
@@ -1174,7 +1174,7 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["claude:cli"])),
Some(serde_json::json!(["claude:messages"])),
encrypt_python_fernet_plaintext(
DEVELOPMENT_ENCRYPTION_KEY,
"sk-upstream-claude-code-oauth",
@@ -1182,7 +1182,7 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"claude:cli": 1})),
Some(serde_json::json!({"claude:messages": 1})),
None,
None,
Some(
@@ -1575,7 +1575,7 @@ async fn gateway_executes_claude_chat_stream_via_local_decision_gate_with_local_
true,
false,
Some(serde_json::json!(["claude"])),
Some(serde_json::json!(["claude:chat"])),
Some(serde_json::json!(["claude:messages"])),
Some(serde_json::json!(["claude-sonnet-4-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -1586,7 +1586,7 @@ async fn gateway_executes_claude_chat_stream_via_local_decision_gate_with_local_
Some(5),
Some(4_102_444_800),
Some(serde_json::json!(["claude"])),
Some(serde_json::json!(["claude:chat"])),
Some(serde_json::json!(["claude:messages"])),
Some(serde_json::json!(["claude-sonnet-4-5"])),
)
.expect("auth snapshot should build")
@@ -1600,7 +1600,7 @@ async fn gateway_executes_claude_chat_stream_via_local_decision_gate_with_local_
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-claude-chat-local-stream-1".to_string(),
endpoint_api_format: "claude:chat".to_string(),
endpoint_api_format: "claude:messages".to_string(),
endpoint_api_family: Some("claude".to_string()),
endpoint_kind: Some("chat".to_string()),
endpoint_is_active: true,
@@ -1608,11 +1608,11 @@ async fn gateway_executes_claude_chat_stream_via_local_decision_gate_with_local_
key_name: "prod".to_string(),
key_auth_type: "api_key".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["claude:chat".to_string()]),
key_api_formats: Some(vec!["claude:messages".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"claude:chat": 1})),
key_global_priority_by_format: Some(serde_json::json!({"claude:messages": 1})),
model_id: "model-claude-chat-local-stream-1".to_string(),
global_model_id: "global-model-claude-chat-local-stream-1".to_string(),
global_model_name: "claude-sonnet-4-5".to_string(),
@@ -1622,7 +1622,7 @@ async fn gateway_executes_claude_chat_stream_via_local_decision_gate_with_local_
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "claude-sonnet-4-5-upstream".to_string(),
priority: 1,
api_formats: Some(vec!["claude:chat".to_string()]),
api_formats: Some(vec!["claude:messages".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -1655,7 +1655,7 @@ async fn gateway_executes_claude_chat_stream_via_local_decision_gate_with_local_
StoredProviderCatalogEndpoint::new(
"endpoint-claude-chat-local-stream-1".to_string(),
"provider-claude-chat-local-stream-1".to_string(),
"claude:chat".to_string(),
"claude:messages".to_string(),
Some("claude".to_string()),
Some("chat".to_string()),
true,
@@ -1690,7 +1690,7 @@ async fn gateway_executes_claude_chat_stream_via_local_decision_gate_with_local_
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["claude:chat"])),
Some(serde_json::json!(["claude:messages"])),
encrypt_python_fernet_plaintext(
DEVELOPMENT_ENCRYPTION_KEY,
"sk-upstream-claude-chat-stream",
@@ -1698,7 +1698,7 @@ async fn gateway_executes_claude_chat_stream_via_local_decision_gate_with_local_
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"claude:chat": 1})),
Some(serde_json::json!({"claude:messages": 1})),
None,
None,
Some(serde_json::json!({"enabled": true, "node_id":"proxy-node-claude-chat-stream"})),