Claude CLI not connecting to OpenRouter's gpt-oss-120b - config help needed

2026-04-13 12:381阅读0评论SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐
问题描述:

Hi! I have tried to use openrouter’s free model: gpt-oss-120b with their API. But I couldn’t make the connection. It was failed.
I have shared all the settings related to claude. Kindly have a look and please tell me where I am doing wrong.

image3154×854 265 KB

After doing these settings I ran:
claude --settings ~/.claude/settings.gptoss.json this command from terminal. But it didn’t work.

P.S. If anyone knows a better free alternative to gpt-oss-120b on OpenRouter (or another provider), I’d appreciate suggestions!

@Haleclipse @Roy_yu

Thank you.

网友解答:
--【壹】--:

I LOVE LINUXDO Thanks @neo


--【贰】--:

Integration with Claude Code | OpenRouter | OpenRouter | Documentation
image1322×558 57.3 KB
I don’t understand why you would just fill it out randomly when there’s already documentation available.


--【叁】--:

I’ve told you about this before.

Claude Code uses the Anthropic Message SDK.

For the URL that ultimately sends the LLM request, /v1/messages is auto appended. Therefore, you should avoid filling it in yourself.


--【肆】--:

If you operate it normally, it’s impossible for it not to take effect.

Please provide a screenshot of the failure, rather than just saying it failed.

And I’ve said this many times already:

The base_url only needs to be the domain itself.
image942×128 23.3 KB

Why are you appending /v1 yourself?


--【伍】--:

Yes this is the best way for me.


--【陆】--:

image1430×884 128 KB




THANK YOU SO MUCH. YOU ARE MY HERO @Haleclipse


--【柒】--:

i don’t think you can use open ai compatible endpoint directly in claude code,

you may need a translation layer between them


--【捌】--: 哈雷彗星:

messages

image1920×844 228 KB

Openrouter is openai-compatible? @jv-kssma


--【玖】--:

I will follow and come back. Thanks brother.


--【拾】--:

now this is coming. I have change /v1 then restarted the terminal.

image1920×1033 240 KB


--【拾壹】--:

@Mr_Me Try CCS(cc switch) for config management. Your baseurl was not right like @Haleclipse said.
cc switch: search github for the repo.

The full config works on my laptop:

{
“env”: {
“ANTHROPIC_AUTH_TOKEN”: “sk-your-api-key”,
“ANTHROPIC_BASE_URL”: " https:// openrouter.ai/api",
“ANTHROPIC_MODEL”: “openai/gpt-oss-120b:free”,
“ANTHROPIC_REASONING_MODEL”: “openai/gpt-oss-120b:free”,
“ANTHROPIC_DEFAULT_HAIKU_MODEL”: “openai/gpt-oss-120b:free”,
“ANTHROPIC_DEFAULT_SONNET_MODEL”: “openai/gpt-oss-120b:free”,
“ANTHROPIC_DEFAULT_OPUS_MODEL”: “openai/gpt-oss-120b:free”
},
“includeCoAuthoredBy”: false
}


--【拾贰】--:

image1784×852 157 KB


--【拾叁】--:

He used the --settings method I told him about to switch providers.
There’s no need for CCS to influence this process.


--【拾肆】--:

翻译:
Claude CLI 无法连接到 OpenRouter 的 gpt-oss-120b - 需要配置帮助
搞七捻三
人工智能


由 Mr_Me 于 2 分钟前 发布

扎米尔先生
Mr_Me
2 分钟
您好!我尝试使用 OpenRouter 的免费路由器型号 gpt-oss-120b 及其 API,但连接失败。
我已经分享了所有与 Claude 相关的设置。请您查看一下,并告诉我哪里出错了。

图像
图像
3154×854 265 KB
完成这些设置后,我运行了:
我在终端中执行了 claude --settings ~/.claude/settings.gptoss.json 这个命令,但是没有生效。

PS:如果有人知道 OpenRouter(或其他提供商)上比 gpt-oss-120b 更好的免费替代方案,请不吝赐教!

@Haleclipse @Roy_yu

谢谢。

标签:人工智能
问题描述:

Hi! I have tried to use openrouter’s free model: gpt-oss-120b with their API. But I couldn’t make the connection. It was failed.
I have shared all the settings related to claude. Kindly have a look and please tell me where I am doing wrong.

image3154×854 265 KB

After doing these settings I ran:
claude --settings ~/.claude/settings.gptoss.json this command from terminal. But it didn’t work.

P.S. If anyone knows a better free alternative to gpt-oss-120b on OpenRouter (or another provider), I’d appreciate suggestions!

@Haleclipse @Roy_yu

Thank you.

网友解答:
--【壹】--:

I LOVE LINUXDO Thanks @neo


--【贰】--:

Integration with Claude Code | OpenRouter | OpenRouter | Documentation
image1322×558 57.3 KB
I don’t understand why you would just fill it out randomly when there’s already documentation available.


--【叁】--:

I’ve told you about this before.

Claude Code uses the Anthropic Message SDK.

For the URL that ultimately sends the LLM request, /v1/messages is auto appended. Therefore, you should avoid filling it in yourself.


--【肆】--:

If you operate it normally, it’s impossible for it not to take effect.

Please provide a screenshot of the failure, rather than just saying it failed.

And I’ve said this many times already:

The base_url only needs to be the domain itself.
image942×128 23.3 KB

Why are you appending /v1 yourself?


--【伍】--:

Yes this is the best way for me.


--【陆】--:

image1430×884 128 KB




THANK YOU SO MUCH. YOU ARE MY HERO @Haleclipse


--【柒】--:

i don’t think you can use open ai compatible endpoint directly in claude code,

you may need a translation layer between them


--【捌】--: 哈雷彗星:

messages

image1920×844 228 KB

Openrouter is openai-compatible? @jv-kssma


--【玖】--:

I will follow and come back. Thanks brother.


--【拾】--:

now this is coming. I have change /v1 then restarted the terminal.

image1920×1033 240 KB


--【拾壹】--:

@Mr_Me Try CCS(cc switch) for config management. Your baseurl was not right like @Haleclipse said.
cc switch: search github for the repo.

The full config works on my laptop:

{
“env”: {
“ANTHROPIC_AUTH_TOKEN”: “sk-your-api-key”,
“ANTHROPIC_BASE_URL”: " https:// openrouter.ai/api",
“ANTHROPIC_MODEL”: “openai/gpt-oss-120b:free”,
“ANTHROPIC_REASONING_MODEL”: “openai/gpt-oss-120b:free”,
“ANTHROPIC_DEFAULT_HAIKU_MODEL”: “openai/gpt-oss-120b:free”,
“ANTHROPIC_DEFAULT_SONNET_MODEL”: “openai/gpt-oss-120b:free”,
“ANTHROPIC_DEFAULT_OPUS_MODEL”: “openai/gpt-oss-120b:free”
},
“includeCoAuthoredBy”: false
}


--【拾贰】--:

image1784×852 157 KB


--【拾叁】--:

He used the --settings method I told him about to switch providers.
There’s no need for CCS to influence this process.


--【拾肆】--:

翻译:
Claude CLI 无法连接到 OpenRouter 的 gpt-oss-120b - 需要配置帮助
搞七捻三
人工智能


由 Mr_Me 于 2 分钟前 发布

扎米尔先生
Mr_Me
2 分钟
您好!我尝试使用 OpenRouter 的免费路由器型号 gpt-oss-120b 及其 API,但连接失败。
我已经分享了所有与 Claude 相关的设置。请您查看一下,并告诉我哪里出错了。

图像
图像
3154×854 265 KB
完成这些设置后,我运行了:
我在终端中执行了 claude --settings ~/.claude/settings.gptoss.json 这个命令,但是没有生效。

PS:如果有人知道 OpenRouter(或其他提供商)上比 gpt-oss-120b 更好的免费替代方案,请不吝赐教!

@Haleclipse @Roy_yu

谢谢。

标签:人工智能