MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

Add GPT-5 support

Open dickymoore opened this issue 3 months ago • 2 comments

Responding to issue https://github.com/FoundationAgents/MetaGPT/issues/1880 GPT-5 not supported max_tokens must be max_completion_tokens.

Add GPT-5 support to token accounting and limits (costs, max context, token counting). Treat GPT-5 as multimodal in model capability checks. Expose GPT-5 in SPO app model pickers (optimization/evaluation/execution). Mention GPT-5 in README and example config comments. Preserve existing model behavior and defaults. Feature Docs

README and config2.example.yaml comments updated to include “gpt-5”. No additional RFC/tutorial required; feature is additive. Influence

Cost tracking now includes GPT-5 with placeholder pricing (mirrors GPT‑4o); update when official rates are available. Token counting recognizes GPT-5 to avoid NotImplementedError; falls back to cl100k_base if tiktoken lacks mapping. GPT-5 assumed multimodal; if that’s inaccurate, remove from MULTI_MODAL_MODELS with no broader impact. UI gains GPT-5 options; no change to defaults. Result

No tests were run in this change. Functionality is additive and non-breaking; happy to run tests on request. Other

Update TOKEN_COSTS and TOKEN_MAX when official GPT‑5 pricing/context limits are announced. If desired, constrain multimodal to only confirmed GPT‑5 variants or add versioned aliases (e.g., gpt-5-turbo).

dickymoore avatar Sep 13 '25 14:09 dickymoore

HI dickymorore,

I tried installing your PR with pip and I am facing some issues tiktoken also with the constant warnings

pip install --upgrade git+https://github.com/FoundationAgents/MetaGPT.git@082ff8ee4b0fd3fce40818003c15ca4acd246bfa

2025-11-05 09:04:15.917 | INFO     | metagpt.utils.token_counter:count_message_tokens:445 - Warning: model gpt-5 not found in tiktoken. Using cl100k_base encoding.
2025-11-05 09:04:20.367 | INFO     | metagpt.utils.token_counter:count_output_tokens:536 - Warning: model gpt-5 not found in tiktoken. Using cl100k_base encoding.

Anonym0usWork1221 avatar Nov 05 '25 17:11 Anonym0usWork1221

Hi @Anonym0usWork1221. I've made some more changes, but haven't tested them yet. Please can you try again?

Thanks, Dicky

dickymoore avatar Nov 07 '25 18:11 dickymoore