tonhowtf/omniget · error
Anthropic
Error message
Anthropic: {} What it means
In the models() function's "anthropic" branch, the HTTP response is checked with error_for_status() and any non-success status is wrapped as "Anthropic: {}". It means the Anthropic API (at entry.base_url) rejected the GET /models request with an HTTP error — most commonly invalid x-api-key or a wrong base_url.
Solutions
- Read the wrapped status/body and fix credentials: re-enter a valid Anthropic x-api-key
- Check entry.base_url — it should be the API root (e.g. https://api.anthropic.com/v1) matching the {base}/models call
- Retry on 429/5xx after a delay (respect retry-after)
- Use the test action to validate the key before listing models
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight before models():
let resp = client.head(format!("{}/models", entry.base_url)).header("x-api-key", &entry.key).send().await?;
if !resp.status().is_success() { bail!("Anthropic key/base_url invalido: {}", resp.status()); } Try / catch
match models(entry).await {
Err(e) if e.to_string().starts_with("Anthropic:") => {
if e.to_string().contains("429") { schedule_retry(); } else { prompt_reenter_key(); }
}
other => handle(other),
} Prevention
- Validate the key with a cheap request before saving it
- Normalize base_url to the Anthropic API root (no trailing/missing /v1 surprises)
- Handle 429/529 with backoff instead of failing the whole flow
When it happens
Trigger: Calling models/test for an anthropic entry when the stored key is revoked or mistyped, the base_url is wrong (e.g. missing or extra /v1), or the account is rate-limited/overloaded (429/529).
Common situations: User pasted a key from a different provider; custom proxy base_url that doesn't mirror the Anthropic API shape; expired/rotated key; network proxy returning 4xx/5xx.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- Gemini
- YouTube não retornou URL
- HTTP
- Twitch GQL respondeu HTTP
- Server returned HTML instead of media — the link may have…
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/c95ef6f51b1a1e18.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/ai_keys.rs:331
/// Site do painel (New API): base sem o `/v1`.
fn site_of(base: &str) -> String {
base.trim_end_matches('/')
.trim_end_matches("/v1")
.to_string()
}
/// GET /models (ou equivalente) → ids dos modelos.
pub async fn models(entry: &KeyEntry) -> anyhow::Result<Vec<String>> {
let c = client()?;
let json: serde_json::Value = match entry.kind.as_str() {
"anthropic" => {
c.get(format!("{}/models?limit=1000", entry.base_url))
.header("x-api-key", &entry.key)
.header("anthropic-version", "2023-06-01")
.send()
.await?
.error_for_status()
.map_err(|e| anyhow!("Anthropic: {}", e))?
.json()
.await?
}
"gemini" => {
c.get(format!(
"{}/models?pageSize=1000&key={}",
entry.base_url, entry.key
))
.send()
.await?
.error_for_status()
.map_err(|e| anyhow!("Gemini: {}", e))?
.json()
.await?
}
_ => {
let mut req = c.get(format!("{}/models", entry.base_url));
if !entry.key.is_empty() {View on GitHub (pinned to 8600b91f42)