Expand description
agentctl-auth — Unified auth pool and LLM API client.
Provides:
- AuthPool: credential management (load/save/add/remove/import from auth-profiles.json)
- Credential testing: validate API keys against provider endpoints
- Claude client: Messages API with OAuth stealth headers, token rotation on 429
§Quick Start
use agentctl_auth::{AuthPool, claude};
// Load auth pool
let pool = AuthPool::load(&std::path::PathBuf::from("~/.agentctl/auth.toml"))?;
// Get default Anthropic credential
let (name, cred) = pool.get_default("anthropic").unwrap();
// Build a Claude client with token rotation
let client = claude::ClientBuilder::new()
.pool(&pool)
.build()?;
let response = client.message(
"claude-sonnet-4-20250514",
&[claude::Message::user("Hello!")],
4096,
).await?;
println!("Tokens used: {}", response.usage.input_tokens + response.usage.output_tokens);Re-exports§
pub use credential::Credential;pub use credential::UsageStats;pub use credential::TestResult;pub use pool::AuthPool;pub use test_credential::test_credential;pub use test_credential::test_all;pub use claude::Client as ClaudeClient;pub use claude::Tool;pub use claude::ToolHandler;pub use claude::ToolOutput;pub use claude::AgentLoopResult;pub use claude::Message;pub use claude::ContentBlock;pub use claude::ToolResultBlock;
Modules§
- claude
- Claude Messages API client with OAuth, stealth headers, and automatic token rotation.
- credential
- Core credential types.
- pool
- Auth pool: load, save, manage credentials.
- test_
credential - Test credentials against provider APIs.