Skip to content

[Bug] AI Gateway fails to fetch the model list using x-api-key #13927

Description

@realhuhu

Contact Information

No response

1Panel Version

AI 网关 v1.2.0

Problem Description

使用 Anthropic 协议时,对话正常,但通过 x-api-key 获取模型列表会提示 401 invalid API Key。同一个 Key 改用 Authorization: Bearer 就能正常获取。

Steps to Reproduce

  1. 在网关中配置可正常调用的 Anthropic 模型,并使用有该模型权限的有效 API Key。
  2. 请求 GET /v1/models,携带 x-api-key 和 anthropic-version: 2023-06-01,返回 401。
  3. 同一个 Key 改用 Authorization: Bearer 请求该接口,返回 200。
  4. 同一个 Key 使用 x-api-key 调用 POST /v1/messages,可以正常对话。

The expected correct result

希望 /v1/models 也支持 x-api-key,让 Anthropic 协议的客户端可以正常获取模型列表。

Related log output

{"error":{"message":"invalid API Key","type":"authentication_error","param":null,"code":"invalid_api_key"}}

Additional Information

No response

Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions