feat: improve model selection reliability, make gateway model source of truth#598
Merged
jonathanlab merged 1 commit intomainfrom Jan 27, 2026
Conversation
Contributor
Author
This was referenced Jan 26, 2026
9f0cd38 to
e3828d4
Compare
8deb503 to
ac1bbf2
Compare
joshsny
reviewed
Jan 26, 2026
packages/agent/src/gateway-models.ts
Outdated
| const modelsUrl = `${gatewayUrl}/v1/models`; | ||
|
|
||
| try { | ||
| const response = await fetch(modelsUrl, { |
Contributor
There was a problem hiding this comment.
you shouldn't need an auth token to access this btw
| } | ||
|
|
||
| const PROVIDER_NAMES: Record<string, string> = { | ||
| anthropic: "Anthropic", |
Contributor
There was a problem hiding this comment.
what about OpenAI / Gemini - Gemini models are currently disabled due to a limiting issue but OpenAI ones are available
Contributor
Author
There was a problem hiding this comment.
I found them very inconsistent in usage, I'll try adding OpenAI and see if it's reliable enough
packages/agent/src/gateway-models.ts
Outdated
| // The gateway exposes 200+ models. | ||
| // Update this list to control which we show to the client. | ||
| export const ALLOWED_GATEWAY_MODELS = [ | ||
| "claude-opus-4-5", |
Contributor
There was a problem hiding this comment.
this kinda defeats the point of this PR, no? We should expose the models from the gateway as the source of truth so we don't need to update this?
Contributor
Author
There was a problem hiding this comment.
Agree, I'll get a PR in posthog out for restricting the models to the useful ones for this product so we do not need to do this
e3828d4 to
922af0c
Compare
ac1bbf2 to
56fab62
Compare
joshsny
approved these changes
Jan 27, 2026
922af0c to
81911ab
Compare
56fab62 to
929a2a4
Compare
81911ab to
3529539
Compare
Contributor
Author
Merge activity
|
3529539 to
8fe61a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

TL;DR
Model selection was unreliable/broken.
Added dynamic model selection with PostHog Gateway integration, replacing hardcoded model options.
What changed?
modelsStoreto manage model state and selectionModelSelectorcomponent to use dynamically fetched modelsHow to test?