fix(cli): deliver the Bedrock API key through a named provider - #87191
Conversation
The Bedrock API-key flow stored the bearer token in OPENAI_API_KEY and set a bare `provider: custom`. Since NousResearch#28660 that variable is only honoured for openai.com hosts, so for bedrock-mantle.*.api.aws the token was dropped and requests went out with api_key="no-key-required", a 401 on every call. Write a named `providers.bedrock-mantle` entry with key_env: AWS_BEARER_TOKEN_BEDROCK instead. The named-provider branch in runtime_provider.py resolves key_env; the bare-custom branch cannot. Fixes authentication only. Per-model mantle route selection is separate.
fix(cli): deliver the Bedrock API key through a named provider
|
Fixes #87190
The Bedrock API-key flow put the bearer token in
OPENAI_API_KEYand set a bareprovider: custom. Since #28660 that variable is only honoured for openai.com hosts, so forbedrock-mantle.*.api.awsthe token was dropped and requests went out withapi_key="no-key-required".Writes a named provider instead:
The named-provider branch in
runtime_provider.pyresolveskey_env; the bare-custom branch can't. It also stops writing a Bedrock credential into another vendor's env var, which is what #28660 was guarding against anyway.Scope: authentication only. Picking a model whose mantle route isn't
/v1still fails. #65076 covers that, and the two are independent.Tests:
tests/hermes_cli/test_bedrock_mantle_key_env.pyruns the real setup flow against a tempHERMES_HOME, then hands the config it wrote toresolve_runtime_providerand asserts the token comes out instead of the placeholder. The bug lived in that seam, so testing either half alone would have missed it.Manual: verified end to end on a live account in us-east-1, using
hermes model> Bedrock > API Key and then a real prompt through the gateway onopenai.gpt-5.6-terra.Tested on Linux.