Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(inference): simplify cloud provider hosting checks

Steven Enamakel0da2ccd6312a
diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
index a572bf657c..fa9d5ab015 100644
--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
@@ -64,10 +64,7 @@ pub(super) fn resolve_cloud_slug<'a>(
// OpenhumanJwt entries are exempt: they always delegate to
// make_openhuman_backend which derives the model from config.default_model,
// ignoring whatever effective_model we computed here.
- let hosted = crate::config::schema::cloud_providers::is_hosted_cloud_provider(
- &entry.slug,
- entry.auth_style,
- );
+ let hosted = crate::config::schema::cloud_providers::is_hosted_auth_style(entry.auth_style);
if !hosted && effective_model.trim().is_empty() {
log::warn!(
"[providers][chat-factory] role={} slug={} resolved to empty model — \
@@ -336,12 +333,7 @@ pub(super) fn try_create_cloud_slug_chat_model_from_string_with_native_tools(
);
}
AuthStyle::Anthropic | AuthStyle::None => {}
- style
- if crate::config::schema::cloud_providers::is_hosted_cloud_provider(
- &entry.slug,
- style,
- ) =>
- {
+ style if crate::config::schema::cloud_providers::is_hosted_auth_style(style) => {
#[cfg(not(test))]
if let Err(error) = verify_backend_session_active(config) {
return Some(Err(error));
diff --git a/crates/openhuman-core/src/inference/provider/factory/discovery.rs b/crates/openhuman-core/src/inference/provider/factory/discovery.rs
index eaefb2d449..e08d624cca 100644
--- a/crates/openhuman-core/src/inference/provider/factory/discovery.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/discovery.rs
@@ -39,10 +39,7 @@ pub(crate) fn model_limits_request(
let (slug, raw) = p.split_once(':')?;
let slug = slug.trim();
let entry = config.cloud_providers.iter().find(|e| e.slug == slug)?;
- if crate::config::schema::cloud_providers::is_hosted_cloud_provider(
- &entry.slug,
- entry.auth_style,
- ) {
+ if crate::config::schema::cloud_providers::is_hosted_auth_style(entry.auth_style) {
let (raw_model, _) = split_model_and_temperature(raw);
let model = if raw_model.trim().is_empty() {
model
diff --git a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
index 1ae9766002..9510c2d31e 100644
--- a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
+++ b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
@@ -248,7 +248,9 @@ pub async fn list_configured_models_from_config(
r
}
// Handled above: the managed catalog is served by the registered provider.
- AuthStyle::OpenhumanJwt => request,
+ AuthStyle::OpenhumanJwt => {
+ return Err("hosted cloud catalog is unavailable without a registered host".into());
+ }
AuthStyle::None => request,
};