Skip to content

feat: implement dynamic model cost resolver via models.dev API#28

Open
ganimalqudhaifi wants to merge 1 commit into
anthonyhaussman:mainfrom
ganimalqudhaifi:feat/dynamic-pricing
Open

feat: implement dynamic model cost resolver via models.dev API#28
ganimalqudhaifi wants to merge 1 commit into
anthonyhaussman:mainfrom
ganimalqudhaifi:feat/dynamic-pricing

Conversation

@ganimalqudhaifi

Copy link
Copy Markdown

This PR introduces a dynamic pricing fetcher that automatically retrieves the latest model costs from the models.dev API registry.

Key Improvements:

  • Zero Hardcoding: Eliminates the need to manually hardcode and update prices for Google, Anthropic, and OpenAI models inside the plugin.
  • Dynamic Provider Mapping: Automatically maps OpenCode model IDs to their respective providers in the API registry.
  • Smart Caching: Responses are securely cached in the OS tmpdir with a 24-hour TTL to ensure CLI boot times remain instant without unnecessary network overhead.
  • Conflict-Free: Designed to be completely modular and will seamlessly merge alongside other pending PRs (e.g., model capabilities alignment).

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.

1 participant