Skip to content

fix(auth): honor MINIMAX_API_KEY in credential resolution #192

Description

@NianJiuZst

Summary

ensureAuth() recognizes MINIMAX_API_KEY and returns early, but the request path later calls resolveCredential(), which never reads the environment variable. As a result, setting MINIMAX_API_KEY can pass the initial auth gate and still fail with No credentials found on the first API request.

Reproduction

MINIMAX_API_KEY=sk-xxxxx mmx quota show --output json

The environment key is detected by src/auth/setup.ts, but it is absent from the resolution order in src/auth/resolver.ts.

Expected behavior

MINIMAX_API_KEY should work end-to-end as an authentication source with a documented precedence relative to --api-key, OAuth credentials, and the config-file API key. Region detection should also account for the environment key where applicable.

Suggested coverage

  • resolve a credential from MINIMAX_API_KEY
  • verify precedence against --api-key, OAuth, and config-file credentials
  • cover non-interactive command execution through the real request path
  • confirm region detection behavior for environment-provided keys

Related: #185, #189.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions