Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

期望添加或检查 OpenRouter 支持 #28

Open
YigesMx opened this issue May 28, 2024 · 1 comment
Open

期望添加或检查 OpenRouter 支持 #28

YigesMx opened this issue May 28, 2024 · 1 comment

Comments

@YigesMx
Copy link

YigesMx commented May 28, 2024

当前类 OpenAI 类型的 API 比如 KIMI 是能正常使用的,根据 OpenRouter 的文档,理论上也可以使用 OpenAI 的接口,文档给出了使用 openai 包的示例。

根据示例也能正常使用:

openrouter_client = OpenAI(
    api_key='xxx',
    base_url = 'https://openrouter.ai/api/v1'
)

chat_completion = openrouter_client.chat.completions.create(
    messages=[
        {
            "role": "user",
            "content": "Say this is a test",
        }
    ],
    model="meta-llama/llama-3-8b-instruct:free",
)

print(chat_completion.choices[0].message.content)

但是以下配置,OpenRouter 会返回 404 页面:

[
    {
        "token": "xxx",
        "type": "openai",
        "config": {
            "api_base": "https://openrouter.ai/api/v1",
            "api_key": "xxx",
            "model": "meta-llama/llama-3-8b-instruct:free"
        }
    }
]

请问这是配置的问题,还是 API 规范的问题,希望添加或检查 OpenRouter 的支持,谢谢!

@tian-minghui
Copy link
Owner

日志应该 能看到调用openrouter的url,看是是否符合预期

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants