Skip to content

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

refactor(models): import dependencies directly in submodules

Steven Enamakel5a9332535c43
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 b2e9036f49..e50432a557 100644
--- a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
+++ b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
@@ -3,7 +3,19 @@
//! managed entries), builds an authenticated `/models` request for it, and
//! parses the response.
-use super::*;
+use super::{local_runtime::synthesize_local_runtime_entry, openrouter::validate_openrouter_api_key};
+use super::super::openai_codex::resolve_openai_codex_routing;
+use crate::config::schema::cloud_providers::AuthStyle;
+use crate::config::Config;
+use tinyinference_core::sanitize::sanitize_api_error;
+use tinyinference_llm::catalog::{
+ append_query_param, endpoint_hosts_models_listing, is_openrouter_provider,
+ merge_openai_codex_model_hints, parse_models_response, ModelInfo,
+};
+use tinyinference_llm::providers::openai::codex::{
+ openai_codex_client_version, openai_codex_user_agent, OpenAiCodexRouting,
+ OPENAI_CODEX_ACCOUNT_HEADER, OPENAI_CODEX_ORIGINATOR, OPENAI_CODEX_ORIGINATOR_HEADER,
+};
/// Resolve the API key used to probe a provider's `/models` endpoint.
///
@@ -130,7 +142,7 @@ pub async fn list_configured_models_from_config(
// An entry that authenticates with the managed session is the managed
// catalog: the registered provider lists it, and with none registered
// there is nothing to list.
- if entry.auth_style == crate::config::schema::cloud_providers::AuthStyle::OpenhumanJwt {
+ if entry.auth_style == AuthStyle::OpenhumanJwt {
return match crate::inference::registry::catalog(
crate::inference::provider::factory::PROVIDER_OPENHUMAN,
) {
diff --git a/crates/openhuman-core/src/inference/provider/models/mod.rs b/crates/openhuman-core/src/inference/provider/models/mod.rs
index ce7f1a81bb..452175b0b0 100644
--- a/crates/openhuman-core/src/inference/provider/models/mod.rs
+++ b/crates/openhuman-core/src/inference/provider/models/mod.rs
@@ -1,43 +1,12 @@
-//! Model listing (`list_configured_models` and friends) for a configured
-//! provider.
-//!
-//! Sub-modules, by responsibility:
-//! - [`types`] — the [`ModelInfo`] catalog-entry type.
-//! - [`catalog_listing`] — the `list_configured_models*` request/response
-//! pipeline.
-//! - [`managed_provider`] — the managed (`openhuman`) entry synthesis and
-//! session-safety helpers `list_configured_models_from_config` needs.
-//! - [`local_runtime`] — synthesized entries for `ollama` / `lmstudio` when
-//! the user has no matching `cloud_providers` row.
-//! - [`openrouter`] — OpenRouter detection and API-key validation.
-//! - [`parsing`] — parsing the `/models` response envelope into
-//! [`ModelInfo`] entries.
-
-use super::super::openai_codex::resolve_openai_codex_routing;
-use tinyinference_core::sanitize::sanitize_api_error;
-use tinyinference_llm::providers::openai::codex::{
- openai_codex_client_version, openai_codex_user_agent, OpenAiCodexRouting,
- OPENAI_CODEX_ACCOUNT_HEADER, OPENAI_CODEX_ORIGINATOR, OPENAI_CODEX_ORIGINATOR_HEADER,
-};
+//! Configured and synthesized model catalogs for inference providers.
mod catalog_listing;
mod local_runtime;
mod openrouter;
-use tinyinference_llm::catalog::{
- append_query_param, endpoint_hosts_models_listing, is_openrouter_provider,
- merge_openai_codex_model_hints, parse_models_response, ModelInfo,
-};
-
-#[cfg(test)]
-use catalog_listing::resolve_local_runtime_key;
pub use catalog_listing::{list_configured_models, list_configured_models_from_config};
pub use local_runtime::synthesize_local_runtime_entry;
-// Cross-submodule wiring: each submodule reaches these through `use super::*;`
-// (mirrors the pre-split `include!`-shared scope).
-use openrouter::validate_openrouter_api_key;
-
#[cfg(test)]
#[path = "../models_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/inference/provider/models/openrouter.rs b/crates/openhuman-core/src/inference/provider/models/openrouter.rs
index 437fe26ace..018cd61d04 100644
--- a/crates/openhuman-core/src/inference/provider/models/openrouter.rs
+++ b/crates/openhuman-core/src/inference/provider/models/openrouter.rs
@@ -1,6 +1,6 @@
//! OpenRouter detection and API-key validation.
-use super::*;
+use tinyinference_core::sanitize::sanitize_api_error;
pub(super) async fn validate_openrouter_api_key(
client: &reqwest::Client,