MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / provider_base_url

Function provider_base_url

crates/opencode-provider/src/bootstrap.rs:2172–2188  ·  view source on GitHub ↗
(provider: &ProviderState)

Source from the content-addressed store, hash-verified

2170}
2171
2172fn provider_base_url(provider: &ProviderState) -> Option<String> {
2173 provider_option_string(provider, &["baseURL", "baseUrl", "url", "api"]).or_else(|| {
2174 provider
2175 .models
2176 .values()
2177 .find_map(|model| (!model.api.url.trim().is_empty()).then(|| model.api.url.clone()))
2178 })
2179 .or_else(|| {
2180 // GLM Coding Plan requires a dedicated endpoint instead of the generic API.
2181 // TS users commonly configure this as provider id `zhipuai-coding-plan`.
2182 if provider.id == "zhipuai-coding-plan" {
2183 Some("https://open.bigmodel.cn/api/coding/paas/v4".to_string())
2184 } else {
2185 None
2186 }
2187 })
2188}
2189
2190fn create_concrete_provider(
2191 provider_id: &str,

Callers 1

create_concrete_providerFunction · 0.85

Calls 3

provider_option_stringFunction · 0.85
is_emptyMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected