Skip to content

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

refactor(inference): add endpoint redaction utility

Steven Enamakel7eaef132ebb4
diff --git a/crates/openhuman-core/src/inference/provider/factory.rs b/crates/openhuman-core/src/inference/provider/factory.rs
index c49c54bc20..36d97c78d2 100644
--- a/crates/openhuman-core/src/inference/provider/factory.rs
+++ b/crates/openhuman-core/src/inference/provider/factory.rs
@@ -31,7 +31,7 @@ pub use chat_model::{
create_chat_model_in, create_chat_model_with_model_id_in, probe_inference_readiness,
};
pub(crate) use credentials::openai_bearer_is_oauth;
-pub use credentials::{auth_key_for_slug, lookup_key_for_slug, redact_endpoint};
+pub use credentials::{auth_key_for_slug, lookup_key_for_slug};
pub(crate) use discovery::{model_limits_request, model_limits_request_for};
pub(crate) use local_runtime::create_local_chat_model_from_string;
pub(crate) use managed_backend::make_openhuman_backend_model;
@@ -103,6 +103,18 @@ use tinyinference_llm::providers::openai::codex::{
};
use tinyinference_llm::providers::openai::AuthStyle as CompatAuthStyle;
+/// Redact a configured endpoint to its origin for host diagnostics.
+///
+/// TinyInference's sanitizer keeps URL paths for routing diagnostics, while
+/// OpenHuman endpoints may carry credentials in path segments. Keep this host
+/// log policy origin-only and never fall back to the unparsed input.
+pub fn redact_endpoint_origin(endpoint: &str) -> String {
+ let Ok(url) = url::Url::parse(endpoint.trim()) else {
+ return "<endpoint>".to_string();
+ };
+ tinyinference_core::sanitize::redact_url(&url.origin().ascii_serialization())
+}
+
/// Sentinel meaning "use the OpenHuman backend session JWT".
pub const PROVIDER_OPENHUMAN: &str = "openhuman";
/// Provider id used for the managed OpenHuman inference backend.