Skip to content

feat(py/openai): refresh the OpenAI model catalog - #128

Merged
cabljac merged 30 commits into
mainfrom
feat/py-openai-catalog
Nov 30, 2026
Merged

cabljac merged 30 commits into
mainfrom
feat/py-openai-catalog

Conversation

@cabljac

@cabljac cabljac commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What's new

Behaviour changes

  • Shut-down chat ids (gpt-4, gpt-3.5-turbo, o1, o4-mini, ...), gpt-oss and gpt-5.2-chat are not registered at init and resolve by name with generic info, as in the pending JS, Go and Dart PRs (feat(js/plugins/compat-oai): refresh OpenAI model catalog genkit#7201, feat(go/plugins/compat_oai): refresh OpenAI model catalog and listing genkit#7202, feat(genkit_openai): refresh OpenAI model catalog genkit-dart#748). On a compatible host still serving gpt-4, schema-less JSON sends json_object, not text, and the Dev UI shows generic flags.
  • dall-e-3 and gpt-image-1 leave the image catalog.
  • chat-latest sends max_output_tokens as max_completion_tokens, not max_tokens.
  • GPT Image quality gains auto, plus xhigh and max on gpt-image-2.5, 2.6 and newer models. On gpt-image-2, gpt-image-1.x and chatgpt-image-latest xhigh and max return a failed response (INVALID_ARGUMENT, no API call) instead of raising, and the error names the extra={'quality': ...} override. DALL-E is unchanged.
  • Discovery hides OpenAI's realtime, live, moderation, Sora and legacy completion ids on every host; custom ids such as my-realtime-llama stay listed. On api.openai.com and regional hosts it also hides Responses-only (including gpt-oss), codex, -pro, DALL-E, gpt-image-1 and -audio ids (the plugin returns no audio). Hidden ids still resolve by name.
  • Fine-tunes are classified by their base model in discovery and resolve, so ft:gpt-4o-mini:org:tts-x:id is chat, not TTS.

Catalog

  • Adds gpt-5.4 to gpt-5.6, the GPT-6 family, chat-latest, gpt-5-search-api, gpt-image-2.5 and 2.6, and gpt-transcribe (text output only).
  • deprecated on announced shutdowns: gpt-4o, gpt-4.1, o3, gpt-5, gpt-5.1, gpt-5.4-nano, TTS, older STT, gpt-image-2, gpt-image-1.5, gpt-image-1-mini and chatgpt-image-latest.
  • gpt-6-astra, gpt-6.1-sol and gpt-5-search-api declare no tools.
  • Dated snapshots of a catalog alias take its info and stage except constrained, so JSON keeps prompt instructions, as on main. Snapshots of shut-down aliases and gpt-4o-2024-05-13 get generic info.
ai.generate(model='openai/gpt-image-2.5-flare', prompt='...', config={'quality': 'xhigh'})
# before: raises INVALID_ARGUMENT from config validation
# after: sent as quality='xhigh'

ai.generate(model='openai/gpt-image-2', prompt='...', config={'quality': 'xhigh'})
# before: raises INVALID_ARGUMENT from config validation
# after: failed response, INVALID_ARGUMENT, no API call

Part of genkit-ai/genkit#5898.

Why

16 of 31 registered chat models and both image models were shut down, discovery listed realtime and moderation ids as chat, and valid image values failed:

GenkitError: INVALID_ARGUMENT: openai/gpt-image-2.5-flare: config 'quality': Input should be 'low', 'medium' or 'high', got 'xhigh'

Tests

  • tests/discovery_test.py: per-host filtering (8 base URLs, 3 config sources), custom names stay listed.
  • tests/openai_plugin_test.py: catalog, stages, generic info for shut-down ids and snapshots, fine-tunes, json_object for generic ids.
  • tests/openai_generate_config_test.py: config={'model': ...} outside the catalog; snapshot vs alias prompt.
  • tests/image_model_test.py: stages, per-model quality enum, the local error, extra.
  • pytest packages/genkit-openai: 908 passed. ruff and pyright pass.
  • Live: real /v1/models lists 68 of 99 (main 88); chat, tools, JSON and streaming pass on every catalog model; shut-down ids 404; every image model and quality works; TTS and STT work, diarize included.

Not in this PR

The chat catalog now lists only models that Chat Completions serves:
gpt-5.4 to gpt-5.6 (sol, terra, luna), the GPT-6 family, chat-latest
and gpt-5-search-api are in, and shut-down and Responses-only ids are
out. Models with an announced shutdown carry stage 'deprecated'.
gpt-5.4, gpt-5.4-mini, gpt-5.4-nano, gpt-5.5, gpt-5.6-sol/terra/luna,
gpt-6-sol and gpt-6-luna declare tools, which need reasoning_effort='none'
on Chat Completions.
gpt-5-search-api declares no tools.

The image catalog adds gpt-image-2.5/2.6 Sunburst and Flare and a
deprecated gpt-image-2. OpenAIGptImageConfig.quality accepts low,
medium, high, xhigh, max and auto.
gpt-transcribe is registered with text output only.

Discovery lists only ids the plugin can call. It hides realtime, live,
audio, moderation, diarize, pro, codex, cyber (except gpt-6-cyber),
daybreak, Rosalind and legacy completion ids, and DALL-E.
chatgpt-image-latest is an image model. Dated snapshots take their
alias's info and stage, and ft: fine-tunes take their base model's.
A shared fixture drives the discovery tests.

Breaking changes:
- KnownGpt drops the shut-down ids (gpt-4-turbo, gpt-3.5-turbo, o1,
  o3-mini, o4-mini, gpt-5-chat-latest, gpt-5.2-chat, gpt-oss and
  others), plus dall-e-3 and gpt-image-1.
- Removed ids leave init() and the Dev UI list. They still resolve by
  name with their old supports through a private map.
- gpt-transcribe no longer advertises json output.

@hilariie hilariie left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The body lists breaking changes but the title has no !. If the break is just the removed ids leaving init() and KnownGpt, either mark it feat(py/openai)!: or soften the breaking section.

Comment thread packages/genkit-openai/README.md Resolved
@cabljac

cabljac commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

@hilariie softened instead: the breaking-changes section is gone. Nothing public changes. KnownGpt has been private since #6512, OpenAI.gpt() takes any string, and removed ids still resolve by name. That matches #6223, which removed catalog ids without !.

@cabljac
cabljac marked this pull request as ready for review November 16, 2026 17:36
cabljac and others added 9 commits November 16, 2026 18:13
- hide gpt-3.5-turbo-instruct and the Responses-only gpt-oss ids from discovery
- name the extra override in the image quality error
- say in the README that the discovery filter applies on any host and hidden ids resolve by name
- pin every catalog stage, the o3 and gpt-5-search-api supports, schema-less JSON on gpt-4 and a dated gpt-6-cyber id in tests
- fix a stale docstring and a misplaced comment
- keep only the fixture fields the discovery test reads
…ional hosts

Compatible hosts skipped the discovery filter entirely, so realtime,
moderation, Sora and legacy completion ids were listed as chat models on
proxies such as LiteLLM. babbage, davinci, codex and -pro ids, hidden on
every host on main, were listed again.

Split the filter. Ids no host serves through this plugin's endpoints are
hidden everywhere. Ids OpenAI serves only on other APIs (Responses-only,
-audio, DALL-E, gpt-image-1) are hidden only on api.openai.com and its
regional subdomains, so us.api.openai.com and eu.api.openai.com are
filtered too.

Dated snapshots of retired aliases, such as o4-mini-2025-04-16, now take
the alias's legacy info instead of generic info.

Pin the legacy supports with literal values: replacing o1's supports
previously left the suite green.
The handler looked up the action's id in SUPPORTED_OPENAI_MODELS to check
config.model. Ids moved to the legacy catalog, dated snapshots, fine-tunes
and other uncataloged ids raised KeyError, so generate returned
finish_reason=failed. The handler now takes the info the plugin resolved.
A dated snapshot took its alias's constrained=ALL, so Genkit dropped the
JSON format instructions from the prompt and relied on response_format
json_schema alone. Older snapshots can predate their alias's structured
output support, and compatible hosts may not enforce it. Snapshots now take
their alias's supports and stage without constrained output, which keeps
the prompt they sent before.
…very

The realtime and moderation filter matched anywhere in the id, so custom
models such as my-realtime-llama on Ollama or vLLM were hidden from
list_actions. Match only OpenAI's gpt-*realtime* and omni-/text-moderation
ids.
The legacy completion filter matched only ada, babbage, curie and davinci
with a -NNN suffix, so davinci, davinci-instruct-beta,
text-similarity-davinci-001 and text-search-* ids were listed as chat.
Match babbage, curie and davinci as any id segment, as main did, and the
old text-/code- similarity and search families. text-embedding-ada-002
stays listed.
OpenAI's id is gpt-5.2-chat-latest, which the gpt-5.2-chat key never
matched, so it resolved with generic info. Add it next to gpt-5.2-chat,
which stays for callers that use that name.
@cabljac

cabljac commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Some screenshots from live tests:

imageimage
image
image

Note: found a bug

when you send audio from the Dev UI playground, it adds a text part that is one space (" ") to the message. The plugin uses any message text as the transcription prompt. So in the Dev UI, diarize always fails, and gpt-4o-transcribe gets worse. Will fix separately.

cabljac and others added 3 commits November 17, 2026 16:19
Remove the legacy capabilities table. A chat id that OpenAI has shut
down now resolves by name with generic info, as the JS, Go and Dart
plugins do. Genkit core acts only on `constrained` at runtime and does
not enforce the tools and media flags, so the request still goes out.

A dated snapshot takes its alias's info only when the alias is in the
catalog. gpt-4o-2024-05-13 is shut down and gets generic info, not the
live gpt-4o info.

On a compatible host that still serves gpt-4, schema-less JSON output
now sends response_format json_object instead of text.
Snapshots drop constrained output, and shut-down snapshots such as gpt-4o-2024-05-13 get generic capabilities.

@huangjeff5 huangjeff5 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified against a fake OpenAI server: gpt-image-2 + xhigh comes back failed with no request, extra sends it, discovery lists 71 ids on api/eu and 106 on a custom host, chat-latest sends max_completion_tokens. The failed-response shape for image quality and generic info for shut-down ids both look right to me. Comments inline, none blocking.

nit: the body says shut-down ids resolve generically "as in JS, Go and Dart". That holds once genkit-ai/genkit#7201, genkit-ai/genkit#7202 and genkit-ai/genkit-dart#748 land; today JS and Go still register gpt-4 with text-only info, so schema-less JSON sends text there and json_object here. Maybe "as in the pending JS, Go and Dart PRs".

Comment thread packages/genkit-openai/README.md Resolved
- Anchor the babbage/curie/davinci discovery filter so compatible-host
  ids like llama-3-davinci and marie-curie-7b stay listed.
- Deny xhigh/max quality only on GPT Image models known to reject it,
  so new models such as gpt-image-3 are not refused locally.
- Drop the gpt-4o-mini-2024-07-18 catalog key so it derives its info
  from gpt-4o-mini like every other dated snapshot.
- Clarify the quality error: move the value into extra to send it.
- Remove the handler's version check. No catalog entry sets versions,
  so it never raised, and its catalog lookup failed for ids resolved
  by name.
- README: split the usage notes into Tools on reasoning models, Model
  discovery and Image quality sections.
@cabljac

cabljac commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

@huangjeff5 thanks! The body now says "as in the pending JS, Go and Dart PRs".

# Conflicts:
#	packages/genkit-openai/README.md
#	packages/genkit-openai/src/genkit_openai/_openai_plugin.py
- Add a test that Mistral catalog and unknown ids get Mistral's label
  and supports, and that get_model_info returns them.
- Use the action's info for supports at call time. OpenAIModel reads
  only supports.output, which listed and default Mistral supports share.
@cabljac
cabljac enabled auto-merge (squash) November 30, 2026 09:41
@cabljac
cabljac merged commit 4493619 into main Nov 30, 2026
21 checks passed
@cabljac
cabljac deleted the feat/py-openai-catalog branch November 30, 2026 09:42
@huangjeff5 huangjeff5 mentioned this pull request Dec 3, 2026
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.

3 participants