Skip to content

Fail open for GPT-5 model tokenisers - #596

Merged
hauntsaninja merged 2 commits into
mainfrom
gpt5enc
Aug 17, 2026
Merged

Fail open for GPT-5 model tokenisers#596
hauntsaninja merged 2 commits into
mainfrom
gpt5enc

Conversation

@hauntsaninja

Copy link
Copy Markdown
Collaborator

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a34ef03435

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tiktoken/model.py
"o4-mini-": "o200k_base",
# chat
"gpt-5-": "o200k_base",
"gpt-5": "o200k_base",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve a delimiter after the GPT-5 family name

When callers pass a different family or a typo such as gpt-50 or gpt-5foo, this delimiter-free prefix now silently selects o200k_base instead of raising the documented KeyError. That can produce incorrect token counts for future model families; retain the hyphenated prefix and add only the specific additional GPT-5 separators that need fail-open handling, such as gpt-5..

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve a delimiter after the GPT-5 family name

When callers pass a different family or a typo such as gpt-50 or gpt-5foo, this delimiter-free prefix now silently selects o200k_base instead of raising the documented KeyError. That can produce incorrect token counts for future model families; retain the hyphenated prefix and add only the specific additional GPT-5 separators that need fail-open handling, such as gpt-5..

Useful? React with 👍 / 👎.

@hauntsaninja
hauntsaninja merged commit 212b893 into main Aug 17, 2026
74 checks passed
@hauntsaninja
hauntsaninja deleted the gpt5enc branch August 17, 2026 05:11
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.

2 participants