tonhowtf/omniget · error
informe o token de acesso e o ID de usuario do painel
Error message
informe o token de acesso e o ID de usuario do painel
What it means
The balance() function supports several provider kinds; for the 'newapi' kind it requires both an access token and a user ID from the panel. If the key entry's access_token field is empty, it throws this Portuguese-language error telling the user to provide the panel's access token and user ID.
Solutions
- Edit the key entry and fill in the access token (from the panel's token page) and the user ID (shown in the panel profile).
- Save the entry and re-run the balance check.
- If the panel exposes an API-key-based balance route instead, set the provider kind to one that uses the API key rather than 'newapi'.
Example fix
// before
entry.access_token = "" // balance() fails
// after
entry.access_token = "eyJhbGciOi..."; // panel access token
entry.user_id = Some("42"); // panel user ID Defensive patterns
Strategy: validation
Validate before calling
// guard before calling balance()
let entry = get(id)?;
if entry.access_token.is_empty() {
eprintln!("newapi panels need access_token AND user id from the panel");
} Type guard
fn can_query_balance(e: &KeyEntry) -> bool { !e.access_token.is_empty() } Try / catch
match balance(id) {
Ok(text) => show(text),
Err(e) if e.to_string().contains("informe o token de acesso") => open_panel_credentials_form(),
Err(e) => show_error(e),
} Prevention
- Collect access token and user ID when adding newapi/one-api panel keys
- Link users to the panel's token page in your onboarding UI
- Validate required fields at entry save time, not at query time
- Distinguish API keys from panel access tokens in the data model
When it happens
Trigger: Calling balance(id) on a key entry whose provider is classified as 'newapi' but whose access_token field was never filled in (only the API key was stored).
Common situations: NewAPI/one-api style panels need token + user ID for the /api/user/self balance endpoint; users often save only the sk- API key and omit the panel access token and numeric user ID.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/26929681cff45c79.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/ai_keys.rs:477
let j: serde_json::Value = c
.get(format!("{}/user/info", entry.base_url))
.bearer_auth(&entry.key)
.send()
.await?
.error_for_status()?
.json()
.await?;
format!(
"{} CNY",
j["data"]["balance"]
.as_str()
.or_else(|| j["data"]["totalBalance"].as_str())
.unwrap_or("?")
)
}
"newapi" => {
if entry.access_token.is_empty() {
return Err(anyhow!(
"informe o token de acesso e o ID de usuario do painel"
));
}
let j: serde_json::Value = c
.get(format!("{}/api/user/self", site_of(&entry.base_url)))
.bearer_auth(&entry.access_token)
.header("New-Api-User", &entry.user_id)
.send()
.await?
.error_for_status()?
.json()
.await?;
if j["success"].as_bool() == Some(false) {
return Err(anyhow!(
"{}",
j["message"].as_str().unwrap_or("painel recusou")
));
}View on GitHub (pinned to 8600b91f42)