pub const GO_PROVIDER: &str = "opencode-go";
pub fn is_anthropic_model(model_id: &str) -> bool {
matches!(model_id, "minimax-m2.7" | "qwen3.5-plus" | "qwen3.6-plus")
}
pub fn anthropic_api_base(provider_api_base: Option<&str>) -> String {
let base = provider_api_base
.unwrap_or("https://opencode.ai/zen/go/v1")
.trim_end_matches('/');
base.strip_suffix("/v1").unwrap_or(base).to_owned()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn go_anthropic_models_detected() {
assert!(is_anthropic_model("minimax-m2.7"));
assert!(is_anthropic_model("qwen3.5-plus"));
assert!(is_anthropic_model("qwen3.6-plus"));
}
#[test]
fn go_non_anthropic_models() {
assert!(!is_anthropic_model("glm-5.1"));
assert!(!is_anthropic_model("kimi-k2.6"));
assert!(!is_anthropic_model("deepseek-v4-pro"));
assert!(!is_anthropic_model("mimo-v2-pro"));
assert!(!is_anthropic_model("minimax-m2.5"));
}
#[test]
fn anthropic_base_url_strips_v1() {
assert_eq!(
anthropic_api_base(Some("https://opencode.ai/zen/go/v1")),
"https://opencode.ai/zen/go"
);
assert_eq!(
anthropic_api_base(Some("https://opencode.ai/zen/go/v1/")),
"https://opencode.ai/zen/go"
);
}
}