import requests

ARQUIVO_KEYS = "keys.txt"
URL_TESTE = "https://api.deepseek.com/user/balance"  # <-- troca pela sua API

def testar_chave(api_key):
    headers = {
        "Authorization": f"Bearer {api_key}"
    }

    try:
        response = requests.get(URL_TESTE, headers=headers, timeout=5)

        if response.status_code == 200:
            return "VALIDA ✅"
        elif response.status_code == 401:
            return "INVALIDA ❌ (não autorizada)"
        else:
            return f"ERRO ⚠️ ({response.status_code})"

    except requests.exceptions.RequestException as e:
        return f"FALHA 🚫 ({e})"


def main():
    with open(ARQUIVO_KEYS, "r") as f:
        keys = [linha.strip() for linha in f if linha.strip()]

    for key in keys:
        resultado = testar_chave(key)
        print(f"{key} -> {resultado}")


if __name__ == "__main__":
    main()
