What version of Kimi CLI is running?
0.54
Which open platform/subscription were you using?
kimi-for-coding
Which model were you using?
openai/gpt-5.1-codex
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64
What issue are you seeing?
Since we have a config.json where we can customize different providers and models, I setup openrouter with openai/gpt-5.1-codex. After launch, simply type "hi" and get "Authorization failed, please check your API key" but I can see my key here and it's valid as I just used it:
my config.json
{
"default_model": "gpt-5.1-codex",
"models": {
"kimi-for-coding": {
"provider": "kimi-for-coding",
"model": "kimi-for-coding",
"max_context_size": 262144
},
"gpt-5.1-codex": {
"provider": "openrouter",
"model": "openai/gpt-5.1-codex",
"max_context_size": 400000,
"capabilities": ["thinking"]
},
"glm-4.6": {
"provider": "openrouter",
"model": "z-ai/glm-4.6",
"max_context_size": 203000
}
},
"providers": {
"kimi-for-coding": {
"type": "kimi",
"base_url": "https://api.kimi.com/coding/v1",
"api_key": "my-key"
},
"openrouter": {
"type": "openai_legacy",
"base_url": "https://openrouter.ai/api/v1",
"api_key": "my-key"
}
},
"loop_control": {
"max_steps_per_run": 100,
"max_retries_per_step": 3
},
"services": {
"moonshot_search": {
"base_url": "https://api.kimi.com/coding/v1/search",
"api_key": "my-key"
}
}
}
full log for the error:
2025-11-14 17:13:48.334 | DEBUG | kimi_cli.ui.shell:run:62 - Exiting by EOF
2025-11-14 17:13:48.335 | DEBUG | kimi_cli.metadata:load_metadata:45 - Loading metadata from file: /home/hehuaisen/.kimi/kimi.json
2025-11-14 17:13:48.336 | DEBUG | kimi_cli.metadata:save_metadata:56 - Saving metadata to file: /home/hehuaisen/.kimi/kimi.json
2025-11-14 17:13:52.598 | INFO | kimi_cli.app:create:53 - Loaded config: default_model='gpt-5.1-codex' models={'kimi-for-coding': LLMModel(provider='kimi-for-coding', model='kimi-for-coding', max_context_size=262144, capabilities=None), 'gpt-5.1-codex': LLMModel(provider='openrouter', model='openai/gpt-5.1-codex', max_context_size=400000, capabilities={'thinking'}), 'glm-4.6': LLMModel(provider='openrouter', model='z-ai/glm-4.6', max_context_size=203000, capabilities=None)} providers={'kimi-for-coding': LLMProvider(type='kimi', base_url='https://api.kimi.com/coding/v1', api_key=SecretStr(''), custom_headers=None), 'openrouter': LLMProvider(type='openai_legacy', base_url='https://openrouter.ai/api/v1', api_key=SecretStr(''), custom_headers=None)} loop_control=LoopControl(max_steps_per_run=100, max_retries_per_step=3) services=Services(moonshot_search=MoonshotSearchConfig(base_url='https://api.kimi.com/coding/v1/search', api_key=SecretStr(''), custom_headers=None))
2025-11-14 17:13:52.598 | INFO | kimi_cli.app:create:80 - Using LLM provider: type='openai_legacy' base_url='https://openrouter.ai/api/v1' api_key=SecretStr('') custom_headers=None
2025-11-14 17:13:52.598 | INFO | kimi_cli.app:create:81 - Using LLM model: provider='openrouter' model='openai/gpt-5.1-codex' max_context_size=400000 capabilities={'thinking'}
2025-11-14 17:13:52.994 | INFO | kimi_cli.soul.runtime:load_agents_md:39 - Loaded agents.md: /home/hehuaisen/kimi-cli/AGENTS.md
2025-11-14 17:13:52.995 | INFO | kimi_cli.soul.agent:load_agent:45 - Loading agent: /home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/agents/default/agent.yaml
2025-11-14 17:13:52.997 | INFO | kimi_cli.soul.agent:_load_system_prompt:86 - Loading system prompt: /home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/agents/default/system.md
2025-11-14 17:13:53.217 | INFO | kimi_cli.soul.agent:_load_tools:116 - Loaded tools: ['Task', 'SetTodoList', 'Bash', 'ReadFile', 'Glob', 'Grep', 'WriteFile', 'StrReplaceFile', 'SearchWeb', 'FetchURL']
2025-11-14 17:13:53.557 | INFO | kimi_cli.soul.agent:load_agent:45 - Loading agent: /home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/agents/default/sub.yaml
2025-11-14 17:13:53.559 | INFO | kimi_cli.soul.agent:_load_system_prompt:86 - Loading system prompt: /home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/agents/default/system.md
2025-11-14 17:13:53.592 | INFO | kimi_cli.soul.agent:_load_tools:116 - Loaded tools: ['Bash', 'ReadFile', 'Glob', 'Grep', 'WriteFile', 'StrReplaceFile', 'SearchWeb', 'FetchURL']
2025-11-14 17:13:53.592 | INFO | kimi_cli.ui.shell.update:_do_update:102 - Checking for updates...
2025-11-14 17:13:54.653 | INFO | kimi_cli.ui.shell:run:85 - Running agent command: [TextPart(type='text', text='hi')] with thinking off
2025-11-14 17:13:55.690 | ERROR | kimi_cli.ui.shell:_run_soul_command:208 - LLM provider error:
Traceback (most recent call last):
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/contrib/chat_provider/openai_legacy.py", line 113, in generate
response = await self.client.chat.completions.create(
│ │ │ │ └ <function AsyncCompletions.create at 0x7f408c541a80>
│ │ │ └ <openai.resources.chat.completions.completions.AsyncCompletions object at 0x7f408c62e510>
│ │ └ <openai.resources.chat.chat.AsyncChat object at 0x7f408c62e3c0>
│ └ <openai.AsyncOpenAI object at 0x7f40902a5010>
└ <kosong.contrib.chat_provider.openai_legacy.OpenAILegacy object at 0x7f408d3de710>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 2603, in create
return await self._post(
│ └ <bound method AsyncAPIClient.post of <openai.AsyncOpenAI object at 0x7f40902a5010>>
└ <openai.resources.chat.completions.completions.AsyncCompletions object at 0x7f408c62e510>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/base_client.py", line 1794, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
│ │ │ │ │ └ openai.AsyncStream[openai.types.chat.chat_completion_chunk.ChatCompletionChunk]
│ │ │ │ └ True
│ │ │ └ FinalRequestOptions(method='post', url='/chat/completions', params={}, headers=NOT_GIVEN, max_retries=NOT_GIVEN, timeout=NOT...
│ │ └ <class 'openai.types.chat.chat_completion.ChatCompletion'>
│ └ <function AsyncAPIClient.request at 0x7f4090707100>
└ <openai.AsyncOpenAI object at 0x7f40902a5010>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/_base_client.py", line 1594, in request
raise self._make_status_error_from_response(err.response) from None
│ └ <function BaseClient._make_status_error_from_response at 0x7f40907042c0>
└ <openai.AsyncOpenAI object at 0x7f40902a5010>
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'No auth credentials found', 'code': 401}}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/hehuaisen/.local/bin/kimi", line 10, in
sys.exit(cli())
│ │ └ <typer.main.Typer object at 0x7f4092068050>
│ └
└ <module 'sys' (built-in)>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/typer/main.py", line 310, in call
return get_command(self)(*args, **kwargs)
│ │ │ └ {}
│ │ └ ()
│ └ <typer.main.Typer object at 0x7f4092068050>
└ <function get_command at 0x7f40921af240>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/click/core.py", line 1462, in call
return self.main(*args, **kwargs)
│ │ │ └ {}
│ │ └ ()
│ └ <function TyperCommand.main at 0x7f40921ae7a0>
└
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/typer/core.py", line 719, in main
return _main(
└ <function _main at 0x7f40921ad940>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/typer/core.py", line 192, in main
rv = self.invoke(ctx)
│ │ └ <click.core.Context object at 0x7f409206b620>
│ └ <function Command.invoke at 0x7f409211e660>
└
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/click/core.py", line 1246, in invoke
return ctx.invoke(self.callback, **ctx.params)
│ │ │ │ │ └ {'version': None, 'yolo': True, 'verbose': False, 'debug': False, 'agent_file': None, 'model_name': None, 'work_dir': None, '...
│ │ │ │ └ <click.core.Context object at 0x7f409206b620>
│ │ │ └ <function kimi at 0x7f4091f78cc0>
│ │ └
│ └ <function Context.invoke at 0x7f409211d8a0>
└ <click.core.Context object at 0x7f409206b620>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/click/core.py", line 814, in invoke
return callback(*args, **kwargs)
│ │ └ {'version': None, 'yolo': True, 'verbose': False, 'debug': False, 'agent_file': None, 'model_name': None, 'work_dir': None, '...
│ └ ()
└ <function kimi at 0x7f4091f78cc0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/typer/main.py", line 691, in wrapper
return callback(**use_params)
│ └ {'version': None, 'verbose': False, 'debug': False, 'agent_file': None, 'model_name': None, 'work_dir': None, 'continue': Fa...
└ <function kimi at 0x7f409222f9c0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/cli.py", line 345, in kimi
succeeded = asyncio.run(_run())
│ │ └ <function kimi.._run at 0x7f40910d4220>
│ └ <function run at 0x7f40925231a0>
└ <module 'asyncio' from '/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/_init...
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
│ │ └ <coroutine object kimi.._run at 0x7f40910ace50>
│ └ <function Runner.run at 0x7f409240e3e0>
└ <asyncio.runners.Runner object at 0x7f40910716a0>
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<kimi.._run() running at /home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3....
│ │ └ <function BaseEventLoop.run_until_complete at 0x7f409240be20>
│ └ <_UnixSelectorEventLoop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0x7f40910716a0>
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/base_events.py", line 712, in run_until_complete
self.run_forever()
│ └ <function BaseEventLoop.run_forever at 0x7f409240bd80>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/base_events.py", line 683, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0x7f409240dbc0>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/base_events.py", line 2050, in _run_once
handle._run()
│ └ <function Handle._run at 0x7f4092344180>
└ <Handle Task.task_wakeup()>
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member '_args' of 'Handle' objects>
│ │ │ │ └ <Handle Task.task_wakeup()>
│ │ │ └ <member '_callback' of 'Handle' objects>
│ │ └ <Handle Task.task_wakeup()>
│ └ <member '_context' of 'Handle' objects>
└ <Handle Task.task_wakeup()>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/cli.py", line 302, in _run
succeeded = await instance.run_shell_mode(command)
│ │ └ None
│ └ <function KimiCLI.run_shell_mode at 0x7f40910b2ac0>
└ <kimi_cli.app.KimiCLI object at 0x7f408dd44d70>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/app.py", line 185, in run_shell_mode
return await app.run(command)
│ │ └ None
│ └ <function ShellApp.run at 0x7f408d39aca0>
└ <kimi_cli.ui.shell.ShellApp object at 0x7f408d927cb0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/ui/shell/init.py", line 90, in run
await self._run_soul_command(user_input.content, user_input.thinking)
│ │ │ │ │ └ False
│ │ │ │ └ UserInput(mode=<PromptMode.AGENT: 'agent'>, thinking=False, command='hi', content=[TextPart(type='text', text='hi')])
│ │ │ └ [TextPart(type='text', text='hi')]
│ │ └ UserInput(mode=<PromptMode.AGENT: 'agent'>, thinking=False, command='hi', content=[TextPart(type='text', text='hi')])
│ └ <function ShellApp._run_soul_command at 0x7f408d39ae80>
└ <kimi_cli.ui.shell.ShellApp object at 0x7f408d927cb0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/ui/shell/init.py", line 185, in _run_soul_command
await run_soul(
└ <function run_soul at 0x7f40911c7560>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/init.py", line 148, in run_soul
soul_task.result() # this will raise if any exception was raised in the run task
│ └ <method 'result' of '_asyncio.Task' objects>
└ <Task finished name='Task-36' coro=<KimiSoul.run() done, defined at /home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python...
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 155, in run
await self._agent_loop()
│ └ <function KimiSoul._agent_loop at 0x7f40910b2340>
└ <kimi_cli.soul.kimisoul.KimiSoul object at 0x7f408dd44ad0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 188, in _agent_loop
finished = await self._step()
│ └ <function KimiSoul._step at 0x7f40910b23e0>
└ <kimi_cli.soul.kimisoul.KimiSoul object at 0x7f408dd44ad0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 232, in _step
result = await _kosong_step_with_retry()
└ <function KimiSoul._step.._kosong_step_with_retry at 0x7f408cf227a0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/init.py", line 189, in async_wrapped
return await copy(fn, *args, **kwargs)
│ │ │ └ {}
│ │ └ ()
│ └ <function KimiSoul._step.._kosong_step_with_retry at 0x7f408cf22340>
└ <AsyncRetrying object at 0x7f408d3df390 (stop=<tenacity.stop.stop_after_attempt object at 0x7f408d3bf8c0>, wait=<tenacity.wai...
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/init.py", line 111, in call
do = await self.iter(retry_state=retry_state)
│ │ └ <RetryCallState 139915209916832: attempt #1; slept for 0.0; last result: failed (APIStatusError Error code: 401 - {'error': {...
│ └ <function AsyncRetrying.iter at 0x7f40910b0ae0>
└ <AsyncRetrying object at 0x7f408d3df390 (stop=<tenacity.stop.stop_after_attempt object at 0x7f408d3bf8c0>, wait=<tenacity.wai...
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/init.py", line 153, in iter
result = await action(retry_state)
│ └ <RetryCallState 139915209916832: attempt #1; slept for 0.0; last result: failed (APIStatusError Error code: 401 - {'error': {...
└ <function wrap_to_async_func..inner at 0x7f408cf22de0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
│ │ └ {}
│ └ (<RetryCallState 139915209916832: attempt #1; slept for 0.0; last result: failed (APIStatusError Error code: 401 - {'error': ...
└ <function BaseRetrying._post_retry_check_actions.. at 0x7f408cf21da0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/init.py", line 400, in
self._add_action_func(lambda rs: rs.outcome.result())
│ │ │ └ <function Future.result at 0x7f4092575e40>
│ │ └ <Future at 0x7f408c62c440 state=finished raised APIStatusError>
│ └ <RetryCallState 139915209916832: attempt #1; slept for 0.0; last result: failed (APIStatusError Error code: 401 - {'error': {...
└ <RetryCallState 139915209916832: attempt #1; slept for 0.0; last result: failed (APIStatusError Error code: 401 - {'error': {...
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
└ None
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
└ None
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/init.py", line 114, in call
result = await fn(*args, **kwargs)
│ │ └ {}
│ └ ()
└ <function KimiSoul._step.._kosong_step_with_retry at 0x7f408cf22340>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 223, in _kosong_step_with_retry
return await kosong.step(
│ └ <function step at 0x7f4091558680>
└ <module 'kosong' from '/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/init.py'>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/init.py", line 158, in step
result = await generate(
└ <function generate at 0x7f4091608900>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/_generate.py", line 53, in generate
stream = await chat_provider.generate(system_prompt, tools, history)
│ │ │ │ └ [Message(role='user', name=None, content=[TextPart(type='text', text='hi')], tool_calls=None, tool_call_id=None, partial=None)]
│ │ │ └ [Tool(name='Task', description='Spawn a subagent to perform a specific task. Subagent will be spawned with a fresh context wi...
│ │ └ "You are Kimi CLI. You are an interactive CLI agent specializing in software engineering tasks. Your primary goal is to help ...
│ └ <function OpenAILegacy.generate at 0x7f4090292ca0>
└ <kosong.contrib.chat_provider.openai_legacy.OpenAILegacy object at 0x7f408d3de710>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/contrib/chat_provider/openai_legacy.py", line 124, in generate
raise convert_error(e) from e
└ <function convert_error at 0x7f4090293d80>
kosong.chat_provider.APIStatusError: Error code: 401 - {'error': {'message': 'No auth credentials found', 'code': 401}}
What steps can reproduce the bug?
Configure some other provider.
After launch, simply type "hi" and get "Authorization failed, please check your API key".
What is the expected behavior?
No response
Additional information
No response
What version of Kimi CLI is running?
0.54
Which open platform/subscription were you using?
kimi-for-coding
Which model were you using?
openai/gpt-5.1-codex
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64
What issue are you seeing?
Since we have a config.json where we can customize different providers and models, I setup openrouter with openai/gpt-5.1-codex. After launch, simply type "hi" and get "Authorization failed, please check your API key" but I can see my key here and it's valid as I just used it:
my config.json
{
"default_model": "gpt-5.1-codex",
"models": {
"kimi-for-coding": {
"provider": "kimi-for-coding",
"model": "kimi-for-coding",
"max_context_size": 262144
},
"gpt-5.1-codex": {
"provider": "openrouter",
"model": "openai/gpt-5.1-codex",
"max_context_size": 400000,
"capabilities": ["thinking"]
},
"glm-4.6": {
"provider": "openrouter",
"model": "z-ai/glm-4.6",
"max_context_size": 203000
}
},
"providers": {
"kimi-for-coding": {
"type": "kimi",
"base_url": "https://api.kimi.com/coding/v1",
"api_key": "my-key"
},
"openrouter": {
"type": "openai_legacy",
"base_url": "https://openrouter.ai/api/v1",
"api_key": "my-key"
}
},
"loop_control": {
"max_steps_per_run": 100,
"max_retries_per_step": 3
},
"services": {
"moonshot_search": {
"base_url": "https://api.kimi.com/coding/v1/search",
"api_key": "my-key"
}
}
}
full log for the error:
2025-11-14 17:13:48.334 | DEBUG | kimi_cli.ui.shell:run:62 - Exiting by EOF
2025-11-14 17:13:48.335 | DEBUG | kimi_cli.metadata:load_metadata:45 - Loading metadata from file: /home/hehuaisen/.kimi/kimi.json
2025-11-14 17:13:48.336 | DEBUG | kimi_cli.metadata:save_metadata:56 - Saving metadata to file: /home/hehuaisen/.kimi/kimi.json
2025-11-14 17:13:52.598 | INFO | kimi_cli.app:create:53 - Loaded config: default_model='gpt-5.1-codex' models={'kimi-for-coding': LLMModel(provider='kimi-for-coding', model='kimi-for-coding', max_context_size=262144, capabilities=None), 'gpt-5.1-codex': LLMModel(provider='openrouter', model='openai/gpt-5.1-codex', max_context_size=400000, capabilities={'thinking'}), 'glm-4.6': LLMModel(provider='openrouter', model='z-ai/glm-4.6', max_context_size=203000, capabilities=None)} providers={'kimi-for-coding': LLMProvider(type='kimi', base_url='https://api.kimi.com/coding/v1', api_key=SecretStr(''), custom_headers=None), 'openrouter': LLMProvider(type='openai_legacy', base_url='https://openrouter.ai/api/v1', api_key=SecretStr(''), custom_headers=None)} loop_control=LoopControl(max_steps_per_run=100, max_retries_per_step=3) services=Services(moonshot_search=MoonshotSearchConfig(base_url='https://api.kimi.com/coding/v1/search', api_key=SecretStr(''), custom_headers=None))
2025-11-14 17:13:52.598 | INFO | kimi_cli.app:create:80 - Using LLM provider: type='openai_legacy' base_url='https://openrouter.ai/api/v1' api_key=SecretStr('') custom_headers=None
2025-11-14 17:13:52.598 | INFO | kimi_cli.app:create:81 - Using LLM model: provider='openrouter' model='openai/gpt-5.1-codex' max_context_size=400000 capabilities={'thinking'}
2025-11-14 17:13:52.994 | INFO | kimi_cli.soul.runtime:load_agents_md:39 - Loaded agents.md: /home/hehuaisen/kimi-cli/AGENTS.md
2025-11-14 17:13:52.995 | INFO | kimi_cli.soul.agent:load_agent:45 - Loading agent: /home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/agents/default/agent.yaml
2025-11-14 17:13:52.997 | INFO | kimi_cli.soul.agent:_load_system_prompt:86 - Loading system prompt: /home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/agents/default/system.md
2025-11-14 17:13:53.217 | INFO | kimi_cli.soul.agent:_load_tools:116 - Loaded tools: ['Task', 'SetTodoList', 'Bash', 'ReadFile', 'Glob', 'Grep', 'WriteFile', 'StrReplaceFile', 'SearchWeb', 'FetchURL']
2025-11-14 17:13:53.557 | INFO | kimi_cli.soul.agent:load_agent:45 - Loading agent: /home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/agents/default/sub.yaml
2025-11-14 17:13:53.559 | INFO | kimi_cli.soul.agent:_load_system_prompt:86 - Loading system prompt: /home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/agents/default/system.md
2025-11-14 17:13:53.592 | INFO | kimi_cli.soul.agent:_load_tools:116 - Loaded tools: ['Bash', 'ReadFile', 'Glob', 'Grep', 'WriteFile', 'StrReplaceFile', 'SearchWeb', 'FetchURL']
2025-11-14 17:13:53.592 | INFO | kimi_cli.ui.shell.update:_do_update:102 - Checking for updates...
2025-11-14 17:13:54.653 | INFO | kimi_cli.ui.shell:run:85 - Running agent command: [TextPart(type='text', text='hi')] with thinking off
2025-11-14 17:13:55.690 | ERROR | kimi_cli.ui.shell:_run_soul_command:208 - LLM provider error:
Traceback (most recent call last):
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/contrib/chat_provider/openai_legacy.py", line 113, in generate
response = await self.client.chat.completions.create(
│ │ │ │ └ <function AsyncCompletions.create at 0x7f408c541a80>
│ │ │ └ <openai.resources.chat.completions.completions.AsyncCompletions object at 0x7f408c62e510>
│ │ └ <openai.resources.chat.chat.AsyncChat object at 0x7f408c62e3c0>
│ └ <openai.AsyncOpenAI object at 0x7f40902a5010>
└ <kosong.contrib.chat_provider.openai_legacy.OpenAILegacy object at 0x7f408d3de710>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 2603, in create
return await self._post(
│ └ <bound method AsyncAPIClient.post of <openai.AsyncOpenAI object at 0x7f40902a5010>>
└ <openai.resources.chat.completions.completions.AsyncCompletions object at 0x7f408c62e510>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/base_client.py", line 1794, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
│ │ │ │ │ └ openai.AsyncStream[openai.types.chat.chat_completion_chunk.ChatCompletionChunk]
│ │ │ │ └ True
│ │ │ └ FinalRequestOptions(method='post', url='/chat/completions', params={}, headers=NOT_GIVEN, max_retries=NOT_GIVEN, timeout=NOT...
│ │ └ <class 'openai.types.chat.chat_completion.ChatCompletion'>
│ └ <function AsyncAPIClient.request at 0x7f4090707100>
└ <openai.AsyncOpenAI object at 0x7f40902a5010>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/_base_client.py", line 1594, in request
raise self._make_status_error_from_response(err.response) from None
│ └ <function BaseClient._make_status_error_from_response at 0x7f40907042c0>
└ <openai.AsyncOpenAI object at 0x7f40902a5010>
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'No auth credentials found', 'code': 401}}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/hehuaisen/.local/bin/kimi", line 10, in
sys.exit(cli())
│ │ └ <typer.main.Typer object at 0x7f4092068050>
│ └
└ <module 'sys' (built-in)>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/typer/main.py", line 310, in call
return get_command(self)(*args, **kwargs)
│ │ │ └ {}
│ │ └ ()
│ └ <typer.main.Typer object at 0x7f4092068050>
└ <function get_command at 0x7f40921af240>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/click/core.py", line 1462, in call
return self.main(*args, **kwargs)
│ │ │ └ {}
│ │ └ ()
│ └ <function TyperCommand.main at 0x7f40921ae7a0>
└
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/typer/core.py", line 719, in main
return _main(
└ <function _main at 0x7f40921ad940>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/typer/core.py", line 192, in main
rv = self.invoke(ctx)
│ │ └ <click.core.Context object at 0x7f409206b620>
│ └ <function Command.invoke at 0x7f409211e660>
└
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/click/core.py", line 1246, in invoke
return ctx.invoke(self.callback, **ctx.params)
│ │ │ │ │ └ {'version': None, 'yolo': True, 'verbose': False, 'debug': False, 'agent_file': None, 'model_name': None, 'work_dir': None, '...
│ │ │ │ └ <click.core.Context object at 0x7f409206b620>
│ │ │ └ <function kimi at 0x7f4091f78cc0>
│ │ └
│ └ <function Context.invoke at 0x7f409211d8a0>
└ <click.core.Context object at 0x7f409206b620>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/click/core.py", line 814, in invoke
return callback(*args, **kwargs)
│ │ └ {'version': None, 'yolo': True, 'verbose': False, 'debug': False, 'agent_file': None, 'model_name': None, 'work_dir': None, '...
│ └ ()
└ <function kimi at 0x7f4091f78cc0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/typer/main.py", line 691, in wrapper
return callback(**use_params)
│ └ {'version': None, 'verbose': False, 'debug': False, 'agent_file': None, 'model_name': None, 'work_dir': None, 'continue': Fa...
└ <function kimi at 0x7f409222f9c0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/cli.py", line 345, in kimi
succeeded = asyncio.run(_run())
│ │ └ <function kimi.._run at 0x7f40910d4220>
│ └ <function run at 0x7f40925231a0>
└ <module 'asyncio' from '/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/_init...
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
│ │ └ <coroutine object kimi.._run at 0x7f40910ace50>
│ └ <function Runner.run at 0x7f409240e3e0>
└ <asyncio.runners.Runner object at 0x7f40910716a0>
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<kimi.._run() running at /home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3....
│ │ └ <function BaseEventLoop.run_until_complete at 0x7f409240be20>
│ └ <_UnixSelectorEventLoop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0x7f40910716a0>
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/base_events.py", line 712, in run_until_complete
self.run_forever()
│ └ <function BaseEventLoop.run_forever at 0x7f409240bd80>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/base_events.py", line 683, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0x7f409240dbc0>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/base_events.py", line 2050, in _run_once
handle._run()
│ └ <function Handle._run at 0x7f4092344180>
└ <Handle Task.task_wakeup()>
File "/home/hehuaisen/.local/share/uv/python/cpython-3.13.7-linux-x86_64-gnu/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member '_args' of 'Handle' objects>
│ │ │ │ └ <Handle Task.task_wakeup()>
│ │ │ └ <member '_callback' of 'Handle' objects>
│ │ └ <Handle Task.task_wakeup()>
│ └ <member '_context' of 'Handle' objects>
└ <Handle Task.task_wakeup()>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/cli.py", line 302, in _run
succeeded = await instance.run_shell_mode(command)
│ │ └ None
│ └ <function KimiCLI.run_shell_mode at 0x7f40910b2ac0>
└ <kimi_cli.app.KimiCLI object at 0x7f408dd44d70>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/app.py", line 185, in run_shell_mode
return await app.run(command)
│ │ └ None
│ └ <function ShellApp.run at 0x7f408d39aca0>
└ <kimi_cli.ui.shell.ShellApp object at 0x7f408d927cb0>
File "/home/hehuaisen/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/ui/shell/init.py", line 90, in run
await self._run_soul_command(user_input.content, user_input.thinking)
│ │ │ │ │ └ False
│ │ │ │ └ UserInput(mode=<PromptMode.AGENT: 'agent'>, thinking=False, command='hi', content=[TextPart(type='text', text='hi')])
│ │ │ └ [TextPart(type='text', text='hi')]
│ │ └ UserInput(mode=<PromptMode.AGENT: 'agent'>, thinking=False, command='hi', content=[TextPart(type='text', text='hi')])
│ └ <function ShellApp._run_soul_command at 0x7f408d39ae80>
└ <kimi_cli.ui.shell.ShellApp object at 0x7f408d927cb0>
kosong.chat_provider.APIStatusError: Error code: 401 - {'error': {'message': 'No auth credentials found', 'code': 401}}
What steps can reproduce the bug?
Configure some other provider.
After launch, simply type "hi" and get "Authorization failed, please check your API key".
What is the expected behavior?
No response
Additional information
No response