Skip to content

fix: map gpt-5.1 model names to o200k_base - #582

Open
Solaris-star wants to merge 1 commit into
openai:mainfrom
Solaris-star:fix/578-gpt-5.1-encoding
Open

fix: map gpt-5.1 model names to o200k_base#582
Solaris-star wants to merge 1 commit into
openai:mainfrom
Solaris-star:fix/578-gpt-5.1-encoding

Conversation

@Solaris-star

Copy link
Copy Markdown

Summary

encoding_for_model("gpt-5.1") raised KeyError because only exact gpt-5 and the hyphenated gpt-5- prefix were mapped. The dotted gpt-5.1 name matches neither.

Changes

  • Add exact gpt-5.1o200k_base
  • Add prefix gpt-5.o200k_base for dated/future dotted 5.x names
  • Extend unit tests for gpt-5.1 and gpt-5.1-…

Testing

  • Pure mapping check for gpt-5 / gpt-5.1 / gpt-5.1-2025-11-13 / gpt-5-mini
  • Native _tiktoken extension not built in this environment; CI should run tests/test_misc.py

Fixes #578

gpt-5.1 uses a dotted name, so it never matched the existing gpt-5-
prefix used for dated snapshots. Add an exact gpt-5.1 entry and a
gpt-5. prefix for future dotted 5.x releases.

Fixes openai#578

Signed-off-by: Solaris-star <820622658@qq.com>
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

Successfully merging this pull request may close these issues.

GPT-5.1 not available

1 participant