feat(config): declare explicit per-model token pricing with cost#3664
Merged
Conversation
Assisted-By: Claude
melmennaoui
approved these changes
Jul 15, 2026
aheritier
added a commit
to aheritier/docs
that referenced
this pull request
Jul 16, 2026
Covers changes from the last 36 hours: - feat: add scheduler toolset docs and config entry (docker/docker-agent#3632) - docs: update MCP header templates, add MCP prompts slash commands (docker/docker-agent#3635) - feat: document safe-auto and safer safety policies for safer_shell (docker/docker-agent#3647) - feat: add custom token pricing (cost config) documentation (docker/docker-agent#3664) - feat: document custom base_url implies bypass_models_gateway (docker/docker-agent#3667) - chore: bump docker-agent vendor to v1.110.0 with accumulated changes (thinking budget gpt-5.6, agents config, CLI toolsets command, OpenAI/ChatGPT/Vercel provider updates, background-agents permissions)
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.
Previously, models not in the models.dev catalogue — custom
base_urlproviders, locally-hosted models, or any model whose pricing the catalogue simply doesn't carry — were priced at $0 with only a log warning. That made session cost tracking and per-turn cost display unreliable for anyone working outside the catalogued set, and there was no way to correct a wrong catalogue price without patching the agent binary.This adds an optional
costblock to model configuration that lets you declare token pricing in USD per million tokens, coveringinput,output,cache_read, andcache_write. When present, it overrides whatever the models.dev catalogue would have returned. An all-zero block is valid and means "priced, but free" — a meaningful distinction from being unpriced. The prices feed the existing per-turn cost computation, session cost accumulation, the/modelpicker display, and theafter_llm_callhook'scostfield. Validation rejects negative values and disallows combiningcostwithfirst_available.The schema (
agent-schema.json) is updated, a worked example lives inexamples/custom-pricing.yaml, and the feature is documented under the "Custom Token Pricing" section indocs/configuration/models/index.mdand referenced indocs/configuration/hooks/index.md. Tests inpkg/config/latest/cost_test.gocover config parsing and validation;pkg/runtime/cost_test.gocovers the runtime cost computation path.