The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(core): add codex routing resolution logic
Steven Enamakelaeb6d9a04f8e
diff --git a/crates/openhuman-core/src/inference/provider/factory/credentials.rs b/crates/openhuman-core/src/inference/provider/factory/credentials.rsindex 7ed2362cb7..91292917ba 100644--- a/crates/openhuman-core/src/inference/provider/factory/credentials.rs+++ b/crates/openhuman-core/src/inference/provider/factory/credentials.rs@@ -54,6 +54,48 @@ pub(crate) fn openai_bearer_is_oauth(config: &Config) -> bool {.is_some()}+/// Resolve host-selected Codex OAuth metadata through TinyInference's shared+/// routing decision while preserving the configured endpoint for standard+/// requests.+pub(crate) fn resolve_codex_routing(+ config: &Config,+ slug: &str,+ endpoint: &str,+ bearer_key: &str,+ bearer_is_oauth: bool,+) -> Result<tinyinference_llm::providers::openai::codex::OpenAiCodexRouting, String> {+ let credentials = if slug == "openai" {+ match crate::security::credentials::openai_oauth::lookup_openai_oauth_credentials(config) {+ Ok(credentials) => credentials,+ Err(error) if !bearer_key.trim().is_empty() => {+ log::warn!(+ "[providers][openai-codex] oauth metadata unavailable; continuing with standard bearer key: {error}"+ );+ None+ }+ Err(error) => {+ return Err(format!("[chat-factory] openai oauth lookup failed: {error}"));+ }+ }+ } else {+ None+ };+ let use_oauth = bearer_is_oauth && credentials.is_some();+ let account_id = credentials+ .filter(|_| use_oauth)+ .and_then(|credentials| credentials.account_id);+ let mut route = tinyinference_llm::providers::openai::codex::resolve_codex_routing(+ slug,+ endpoint,+ use_oauth,+ account_id.as_deref(),+ );+ if !route.using_oauth {+ route.endpoint = endpoint.to_string();+ }+ Ok(route)+}+/// Fetch the bearer token for a slug from the workspace `auth-profiles.json`.////// Tries `provider:<slug>` first (new key format), then the bare `<slug>`