From f2f5f551e3d0adfb1fb5d194329d567e4b79c30d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chindri=C8=99=20Mihai=20-=20Alexandru?= Date: Mon, 6 Apr 2026 22:08:18 +0300 Subject: [PATCH] feat(provider): add Modal as a built-in provider for GLM-5 Add Modal as a new provider in ForgeCode, enabling access to Z.ai's GLM-5 745B parameter model hosted on Modal's infrastructure. Modal offers an OpenAI-compatible API endpoint with free GLM-5 access until April 30th, 2026. Changes: - Add 'modal' entry to provider.json with GLM-5-FP8 model - Add ProviderId::MODAL constant to forge_domain - Wire up display_name ("Modal"), FromStr, and built_in_providers() - Add unit tests for MODAL display name, from_str, and built_in_providers Co-Authored-By: ForgeCode --- crates/forge_domain/src/provider.rs | 22 ++++++++++++++++++++ crates/forge_repo/src/provider/provider.json | 20 ++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/crates/forge_domain/src/provider.rs b/crates/forge_domain/src/provider.rs index a65b43e416..be7498c7e2 100644 --- a/crates/forge_domain/src/provider.rs +++ b/crates/forge_domain/src/provider.rs @@ -73,6 +73,7 @@ impl ProviderId { pub const FIREWORKS_AI: ProviderId = ProviderId(Cow::Borrowed("fireworks-ai")); pub const NOVITA: ProviderId = ProviderId(Cow::Borrowed("novita")); pub const GOOGLE_AI_STUDIO: ProviderId = ProviderId(Cow::Borrowed("google_ai_studio")); + pub const MODAL: ProviderId = ProviderId(Cow::Borrowed("modal")); /// Returns all built-in provider IDs /// @@ -106,6 +107,7 @@ impl ProviderId { ProviderId::FIREWORKS_AI, ProviderId::NOVITA, ProviderId::GOOGLE_AI_STUDIO, + ProviderId::MODAL, ] } @@ -132,6 +134,7 @@ impl ProviderId { "fireworks-ai" => "FireworksAI".to_string(), "novita" => "Novita".to_string(), "google_ai_studio" => "GoogleAIStudio".to_string(), + "modal" => "Modal".to_string(), _ => { // For other providers, use UpperCamelCase conversion use convert_case::{Case, Casing}; @@ -177,6 +180,7 @@ impl std::str::FromStr for ProviderId { "fireworks-ai" => ProviderId::FIREWORKS_AI, "novita" => ProviderId::NOVITA, "google_ai_studio" => ProviderId::GOOGLE_AI_STUDIO, + "modal" => ProviderId::MODAL, // For custom providers, use Cow::Owned to avoid memory leaks custom => ProviderId(Cow::Owned(custom.to_string())), }; @@ -581,6 +585,24 @@ mod tests { assert_eq!(actual, expected); } + #[test] + fn test_modal_from_str() { + let actual = ProviderId::from_str("modal").unwrap(); + let expected = ProviderId::MODAL; + assert_eq!(actual, expected); + } + + #[test] + fn test_modal_display_name() { + assert_eq!(ProviderId::MODAL.to_string(), "Modal"); + } + + #[test] + fn test_modal_in_built_in_providers() { + let built_in = ProviderId::built_in_providers(); + assert!(built_in.contains(&ProviderId::MODAL)); + } + #[test] fn test_io_intelligence() { let fixture = "test_key"; diff --git a/crates/forge_repo/src/provider/provider.json b/crates/forge_repo/src/provider/provider.json index 16dc7899f6..e0f6f9d24d 100644 --- a/crates/forge_repo/src/provider/provider.json +++ b/crates/forge_repo/src/provider/provider.json @@ -3099,5 +3099,25 @@ "input_modalities": ["text"] } ] + }, + { + "id": "modal", + "api_key_vars": "MODAL_API_KEY", + "url_param_vars": [], + "response_type": "OpenAI", + "url": "https://api.us-west-2.modal.direct/v1/chat/completions", + "models": [ + { + "id": "zai-org/GLM-5-FP8", + "name": "GLM-5", + "description": "Z.ai's 745B parameter flagship open-source MoE model for long-horizon agents and systems engineering, hosted on Modal", + "context_length": 192000, + "tools_supported": true, + "supports_parallel_tool_calls": true, + "supports_reasoning": true, + "input_modalities": ["text"] + } + ], + "auth_methods": ["api_key"] } ]