Repository navigation
feat: add coderd_ai_model_price resource - #445
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
ssncferreira
left a comment
There was a problem hiding this comment.
Overall LGTM, just a few notes especially around the case when a custom model price is already set
- Fail the plan when Coder already has a different custom price for the same provider type and model, and tell the user to import it. Adopt an existing price that equals the config. - Report "Unsupported Coder Version" when the model prices API returns 404, at plan time and at apply time. - Reword the resource docs, link to the default prices, and note that openai-compat is not supported. - Replace the deferral test with a mock-backed ModifyPlan table test and remove redundant test cases.
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49057992fc
ℹ️ 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".
|
@codex review Re: Do not preserve the ID across key replacements Not an issue. When I checked this with a temporary acceptance test that changed each key in turn. Both plans were destroy-then-create with |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
ssncferreira
left a comment
There was a problem hiding this comment.
LGTM! Thank you for working on this, and addressing the comments 🚀
| "Unable to %s AI model price %s: the deployment returned 404 for /api/experimental/ai/model-prices. "+ | ||
| "This resource requires Coder version %s or later; upgrade the deployment, or remove "+ | ||
| "`coderd_ai_model_price` from your configuration. Original error: %s", |
Closes AIGOV-677
This adds a
coderd_ai_model_priceresource for managing custom AI Gateway model prices. It replaces themodel_config.costfield we removed fromcoderd_agents_modelin #413, which stopped doing anything once cost tracking moved to AI Gateway.I've made it a standalone resource rather than a field on
coderd_agents_model, since prices are deployment-wide and keyed on provider type and model, whilst agents models are org-scoped. Plenty of AI Gateway users (Claude Code, Cursor, Copilot) won't have any agents models at all.For now the resource takes a
provider_typestring, since that's how prices are keyed today. AIGOV-612 will add per-provider prices, so we can either ship this as-is and add an optionalai_provider_idonce that lands (which wouldn't break existing configs), or just wait for AIGOV-612. I'm happy to pick that up myself if we'd rather wait.Unfortunately, Coder has no API to delete a custom price, so for now destroying the resource just removes it from state and warns that the custom price is still set in Coder. Adding a delete endpoint to coder/coder would mean waiting on 2.38, whereas everything else the resource needs has been there since 2.37.0. We'll wire up a real delete once that endpoint exists.