按照官方流程部署但是 但一直报错误的api,哪怕是config.yaml文件什么都不填,没有任何额外操作也会报。
2024-01-21 00:26:47.078 | ERROR | metagpt.utils.common:log_it:438 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 2.463(s), this was the 3rd time calling it. exp: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-SNBWJzaub. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
换了windows系统就解决了。
这是logs日志
2024-01-21 00:26:43.346 | INFO | metagpt.config:get_default_llm_provider_enum:124 - LLMProviderEnum.OPENAI Model: gpt-4-1106-preview
2024-01-21 00:26:43.346 | INFO | metagpt.config:get_default_llm_provider_enum:126 - API: LLMProviderEnum.OPENAI
2024-01-21 00:26:43.346 | DEBUG | metagpt.config:_ensure_workspace_exists:228 - WORKSPACE_PATH set to /Users/chen/Desktop/mm/MetaGPT/workspace
2024-01-21 00:26:43.347 | DEBUG | metagpt.config:init:85 - Config loading done.
2024-01-21 00:26:44.498 | INFO | metagpt.config:get_default_llm_provider_enum:124 - LLMProviderEnum.OPENAI Model: gpt-4-1106-preview
2024-01-21 00:26:44.498 | INFO | metagpt.config:get_default_llm_provider_enum:126 - API: LLMProviderEnum.OPENAI
2024-01-21 00:26:44.525 | INFO | metagpt.config:get_default_llm_provider_enum:124 - LLMProviderEnum.OPENAI Model: gpt-4-1106-preview
2024-01-21 00:26:44.525 | INFO | metagpt.config:get_default_llm_provider_enum:126 - API: LLMProviderEnum.OPENAI
2024-01-21 00:26:44.544 | INFO | metagpt.config:get_default_llm_provider_enum:124 - LLMProviderEnum.OPENAI Model: gpt-4-1106-preview
2024-01-21 00:26:44.544 | INFO | metagpt.config:get_default_llm_provider_enum:126 - API: LLMProviderEnum.OPENAI
2024-01-21 00:26:44.563 | INFO | metagpt.config:get_default_llm_provider_enum:124 - LLMProviderEnum.OPENAI Model: gpt-4-1106-preview
2024-01-21 00:26:44.563 | INFO | metagpt.config:get_default_llm_provider_enum:126 - API: LLMProviderEnum.OPENAI
2024-01-21 00:26:44.579 | INFO | metagpt.team:invest:87 - Investment: $3.0.
2024-01-21 00:26:44.579 | DEBUG | metagpt.environment:publish_message:108 - publish_message: {"id":"0e2339426b014215bf6932b9ac384431","content":"Create a 2048 game in python","role":"Human","cause_by":"metagpt.actions.add_requirement.UserRequirement","sent_from":"","send_to":[""]}
2024-01-21 00:26:44.579 | DEBUG | metagpt.team:run:131 - max n_round=4 left.
2024-01-21 00:26:44.579 | DEBUG | metagpt.roles.role:_observe:400 - Alice(Product Manager) observed: ['Human: Create a 2048 game i...']
2024-01-21 00:26:44.579 | DEBUG | metagpt.roles.role:_set_state:292 - actions=[PrepareDocuments, WritePRD], state=0
2024-01-21 00:26:44.579 | DEBUG | metagpt.roles.role:_react:431 - Alice(Product Manager): self.rc.state=0, will do PrepareDocuments
2024-01-21 00:26:44.579 | INFO | metagpt.roles.role:_act:360 - Alice(Product Manager): to do PrepareDocuments(PrepareDocuments)
2024-01-21 00:26:44.612 | DEBUG | metagpt.roles.role:run:482 - Bob(Architect): no news. waiting.
2024-01-21 00:26:44.612 | DEBUG | metagpt.roles.role:run:482 - Eve(Project Manager): no news. waiting.
2024-01-21 00:26:44.612 | DEBUG | metagpt.roles.role:run:482 - Alex(Engineer): no news. waiting.
2024-01-21 00:26:44.613 | INFO | metagpt.utils.file_repository:save:61 - save to: /Users/chen/Desktop/mm/MetaGPT/workspace/20240121002644/docs/requirement.txt
2024-01-21 00:26:44.613 | DEBUG | metagpt.roles.role:_set_state:292 - actions=[PrepareDocuments, WritePRD], state=-1
2024-01-21 00:26:44.613 | DEBUG | metagpt.environment:publish_message:108 - publish_message: {"id":"146fe9f0d0e74cd0ab37cd530b441dae","content":"Create a 2048 game in python","instruct_content":{"class":"Document","mapping":{"root_path":"(<class 'str'>, Ellipsis)","filename":"(<class 'str'>, Ellipsis)","content":"(<class 'str'>, Ellipsis)"},"value":{"root_path":"docs","filename":"requirement.txt","content":"Create a 2048 game in python"}},"role":"Alice(Product Manager)","cause_by":"metagpt.actions.prepare_documents.PrepareDocuments","sent_from":"metagpt.roles.product_manager.ProductManager","send_to":[""]}
2024-01-21 00:26:44.613 | DEBUG | metagpt.environment:run:132 - is idle: False
2024-01-21 00:26:44.614 | DEBUG | metagpt.team:run:131 - max n_round=3 left.
2024-01-21 00:26:44.614 | DEBUG | metagpt.roles.role:_observe:400 - Alice(Product Manager) observed: ['Alice(Product Manager): Create a 2048 game i...']
2024-01-21 00:26:44.614 | DEBUG | metagpt.roles.role:_set_state:292 - actions=[PrepareDocuments, WritePRD], state=1
2024-01-21 00:26:44.614 | DEBUG | metagpt.roles.role:_react:431 - Alice(Product Manager): self.rc.state=1, will do WritePRD
2024-01-21 00:26:44.614 | INFO | metagpt.roles.role:_act:360 - Alice(Product Manager): to do WritePRD(WritePRD)
2024-01-21 00:26:44.614 | DEBUG | metagpt.roles.role:run:482 - Bob(Architect): no news. waiting.
2024-01-21 00:26:44.614 | DEBUG | metagpt.roles.role:run:482 - Eve(Project Manager): no news. waiting.
2024-01-21 00:26:44.614 | DEBUG | metagpt.roles.role:run:482 - Alex(Engineer): no news. waiting.
2024-01-21 00:26:45.543 | ERROR | metagpt.utils.common:log_it:438 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 0.928(s), this was the 1st time calling it. exp: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-SNBWJzaub. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
2024-01-21 00:26:46.506 | ERROR | metagpt.utils.common:log_it:438 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 1.891(s), this was the 2nd time calling it. exp: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-SNBWJzaub. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
2024-01-21 00:26:47.078 | ERROR | metagpt.utils.common:log_it:438 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 2.463(s), this was the 3rd time calling it. exp: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-SNBWJzaub. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
从报错看:Incorrect API key provided: sk-SNBWJzaub. You can find your API key at https://platform.openai.com/account/api-keys.
说明你的key已经提供了,但是是错误的,可以检查下你的环境变量 env | grep -i key