fix: cache_control ttl model check + batch create with explicit names#25
Merged
koljahuang merged 3 commits intomainfrom Apr 14, 2026
Merged
fix: cache_control ttl model check + batch create with explicit names#25koljahuang merged 3 commits intomainfrom
koljahuang merged 3 commits intomainfrom
Conversation
added 3 commits
April 14, 2026 16:32
…h explicit names 1. Cache TTL fix: Only Claude 4.5 family models support the `ttl` field in `cache_control`. Non-4.5 models (Sonnet 4, Opus 4, etc.) reject it with "Extra inputs are not permitted". The proxy now checks the model before adding `ttl` and strips it from pre-existing breakpoints on unsupported models. 2. Batch token creation: Replace `count` + `name_prefix` (auto-generated names like prefix-001) with comma-separated `names` string input. Frontend textarea replaces the two input fields. Backend auto-trims whitespace around each name.
Split on ASCII comma, Chinese full-width comma, semicolons, and newlines so names entered with non-ASCII input methods are parsed correctly.
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.
Summary
ttlfield tocache_controlfor Claude 4.5 family models (Opus 4.5, Sonnet 4.5, Haiku 4.5). Non-4.5 models like Sonnet 4 rejectttlwithValidationException: Extra inputs are not permitted. Also stripsttlfrom pre-existing client breakpoints on unsupported models.count+name_prefix(auto-generatedprefix-001,prefix-002) with comma-separatednamesinput. Frontend uses a textarea; backend auto-trims whitespace and ignores empty entries.Changed files
backend/app/services/bedrock.py_model_supports_cache_ttl(),_new_cache_marker(),_inject_prompt_cache_breakpoints()acceptmodel_id;_build_anthropic_body()passesmodel_idthroughbackend/app/api/admin/endpoints/tokens.pyBatchCreateTokenRequest:count+name_prefix→names(comma-separated string)backend/app/services/token.pycreate_tokens_batch():count+name_prefix→names: List[str]backend/tests/test_prompt_cache_injection.pybackend/tests/test_stream_failover.pymodel_idparamfrontend/src/stores/tokens.tsBatchCreateTokenRequestinterface updatedfrontend/src/pages/TokensPage.vueTest plan
X-Bedrock-Auto-Cache: true+ system prompt no longer returnsExtra inputs are not permittedttl: "1h"in cache_control