Credentials

If your evals need a token or a login, declare it as a credential. eac checks them all before starting, so you don't find out halfway through a run that a token is missing.

View on GitHubevals/triage/credentials/openrouter.py
from eac import Credential


class OpenRouterKey(Credential):
    name = "openrouter"

    def is_authenticated(self, env: Mapping[str, str]) -> bool:
        return bool(env.get("OPENROUTER_API_KEY"))

    def authenticate(self) -> dict[str, str]:
        print("Create a key at https://openrouter.ai/settings/keys")
        return {"OPENROUTER_API_KEY": getpass.getpass("OpenRouter API key: ").strip()}

Then add it to the credentials of whatever needs it: a seed, a runner or a judge.

View on GitHubevals/triage/runners/offline.py
class OfflineTriageRunner(OfflineRunner):
    credentials = [OpenRouterKey(), SentryLogin()]

Logging in

If a credential isn't set up, eac offers to run authenticate() for you. Whatever it returns is saved to .eac/credentials/saved.json (never your .env) and reused next time. If authenticate() raises, eac shows the error, so say what to do by hand in it. If there's no authenticate(), the credential can only be set up by hand, so eac doesn't offer to log in.

authenticate() can also hand off to a tool's own login. The example's SentryLogin runs sentry auth login, which keeps its own login, and only returns the project to use.

In CI, where $CI is set, the checks are skipped.

Create API clients when you first use them, not in __init__. eac checks credentials after building your seeds and judges.