Skip to content

[Docs] BYOK section does not cover custom_provider headers, the path #126 was resolved to #211

Closed

Description

@basil-k-aji-dev

Documentation URL or path

README.md (the "Use your own API key (BYOK)" section, lines 82-100)

Problem and suggested improvement

#126 was resolved with the ruling that third-party BYOK belongs in custom_provider rather than minimax_api, since minimax_api is the official endpoint and should keep a fixed auth header. That is a clear answer, but a user cannot currently reach it from the documentation, for two separate reasons.

1. custom_provider and its headers option are undocumented.

custom_provider appears nowhere outside code and two test files:

$ grep -rl "custom_provider" . | grep -v node_modules | grep -vE '\.(ts|tsx|js|json)$'
test/byok.test.mjs
test/smoke.test.mjs

The README's BYOK section documents mcode provider add, never naming custom_provider or mentioning that headers can be set at all. So a user who is told "use custom_provider with Authorization: Bearer" has nothing to follow.

2. The documented command cannot express it.

mcode provider add is the only documented way to configure BYOK, and its request type has no field for headers (packages/tui/src/cli/provider-command.ts:9-20):

| {
    readonly action: 'add';
    readonly name: string;
    readonly baseUrl: string;
    readonly apiFormat: McodeProviderApiFormat;
    readonly models: readonly string[];
    readonly contextLimit?: number;
    readonly outputLimit?: number;
    readonly apiKeyEnv?: string;
    readonly saveAndUse?: boolean;
  }

There is no --header flag. The only route to options.headers is hand-editing the config file — which, per (1), is not documented either. A user following the README lands on a provider that sends x-api-key, gets login fail: Please carry the API secret key in the 'X-Api-Key' field, and has no documented next step. That is the path #126 walked.

Suggested improvement

Two things, in order of cost:

  • Extend the BYOK section to show a relay that authenticates with Authorization: Bearer, name custom_provider as the supported path for any endpoint that is not the official one, and show the options.headers block. Worth stating that api may be omitted: resolveCustomProviderApi (model-resolver-byok.ts:142-150) defaults to anthropic-messages, the same value minimax_api pins at line 61, so a relay serving /v1/messages needs no extra configuration.
  • Consider a --header 'Name: value' flag on mcode provider add, repeatable. Without it the documented interface cannot produce the configuration the documentation would be describing, and every such user has to be told to edit a file by hand.

Happy to open a PR for the README part if that is welcome — it is documentation only and does not touch the design decision in #126. I am not proposing any change to minimax_api.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions