feat:OpenAPI v135: remove tags; anthropic headers; CacheCreation/ttl#175
feat:OpenAPI v135: remove tags; anthropic headers; CacheCreation/ttl#175
Conversation
WalkthroughOpenAPI spec updated to version 135. Operation tags removed from multiple endpoints. Added anthropic-version and anthropic-beta headers. Introduced CacheCreation schema and ttl on CacheControlEphemeral. Usage and BetaUsage now include cache_creation. AnthropicBeta gains context-1m-2025-08-07. Schema-only adjustments across paths. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API as API Endpoint
participant Cache as Cache Service
participant Model as Model Service
Client->>API: POST /v1/messages\nHeaders: anthropic-version, anthropic-beta
API->>Cache: Check/record cache_creation (ttl: 5m|1h)
alt Cache hit
Cache-->>API: Cached usage/counters
else Cache miss
API->>Model: Forward request with version/beta context
Model-->>API: Response + usage
API->>Cache: Store ephemeral usage (ttl)
end
API-->>Client: Response (includes usage.cache_creation)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Poem
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/libs/Anthropic/openapi.yaml (1)
8275-8276: New beta flag value added: context-1m-2025-08-07Looks consistent. Make sure client SDK enums/union types regenerate so this value is accepted programmatically across languages.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (74)
src/libs/Anthropic/Generated/Anthropic..JsonSerializerContext.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaDeleteFileV1FilesFileIdDelete.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaDownloadFileV1FilesFileIdContentGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaGetFileMetadataV1FilesFileIdGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaListFilesV1FilesGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesCancel.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesDelete.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesList.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesResults.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesRetrieve.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessagesCountTokensPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessagesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaUploadFileV1FilesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.CompletePost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.DeleteFileV1FilesFileIdDelete.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.DownloadFileV1FilesFileIdContentGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.GetFileMetadataV1FilesFileIdGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.ListFilesV1FilesGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesCancel.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesDelete.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesList.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesResults.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesRetrieve.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessagesCountTokensPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessagesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.UploadFileV1FilesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.AnthropicClient.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.FilesClient.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaDeleteFileV1FilesFileIdDelete.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaDownloadFileV1FilesFileIdContentGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaGetFileMetadataV1FilesFileIdGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaListFilesV1FilesGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesCancel.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesDelete.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesList.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesResults.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesRetrieve.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessagesCountTokensPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessagesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaUploadFileV1FilesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.CompletePost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.DeleteFileV1FilesFileIdDelete.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.DownloadFileV1FilesFileIdContentGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.GetFileMetadataV1FilesFileIdGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.ListFilesV1FilesGet.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesCancel.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesDelete.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesList.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesResults.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesRetrieve.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessagesCountTokensPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessagesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.UploadFileV1FilesPost.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IFilesClient.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.IMessagesClient.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.ITextCompletionsClient.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.JsonConverters.CacheControlEphemeralTtl.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.JsonConverters.CacheControlEphemeralTtlNullable.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.MessagesClient.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.Models.AnthropicBetaEnum.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeral.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeralTtl.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.Models.CacheCreation.Json.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.Models.CacheCreation.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.Models.Usage.g.csis excluded by!**/generated/**src/libs/Anthropic/Generated/Anthropic.TextCompletionsClient.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/Anthropic/openapi.yaml(4 hunks)
🔇 Additional comments (2)
src/libs/Anthropic/openapi.yaml (2)
4-4: Spec version bump to 135 looks goodNo concerns with the version update.
7996-8006: Makingcache_creationrequired in Usage is a wire-level change—verify server always includes itMarking this as required means every response must now contain
usage.cache_creation. Ensure:
- All code paths that return
Usagepopulatecache_creationwith zeros when no cache is created.- Examples and SDK fixtures are updated accordingly to avoid codegen breakage.
If any legacy endpoints don’t set it yet, consider making the field optional until parity is confirmed.
| ttl: | ||
| title: Ttl | ||
| enum: | ||
| - 5m | ||
| - 1h | ||
| type: string | ||
| description: "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`." | ||
| x-stainless-renameMap: | ||
| ttl_5m: 5m | ||
| ttl_1h: 1h |
There was a problem hiding this comment.
🛠️ Refactor suggestion
TTL property: add default and fix minor grammar
- The description says “Defaults to 5m” but no default is set. Add
default: 5mto align behavior and docs. - Typo: “one the following values” → “one of the following values”.
Proposed patch:
ttl:
title: Ttl
enum:
- 5m
- 1h
type: string
- description: "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`."
+ description: "The time-to-live for the cache control breakpoint.\n\nThis may be one of the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`."
+ default: 5m
x-stainless-renameMap:
ttl_5m: 5m
ttl_1h: 1h📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ttl: | |
| title: Ttl | |
| enum: | |
| - 5m | |
| - 1h | |
| type: string | |
| description: "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`." | |
| x-stainless-renameMap: | |
| ttl_5m: 5m | |
| ttl_1h: 1h | |
| ttl: | |
| title: Ttl | |
| enum: | |
| - 5m | |
| - 1h | |
| type: string | |
| description: "The time-to-live for the cache control breakpoint.\n\nThis may be one of the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`." | |
| default: 5m | |
| x-stainless-renameMap: | |
| ttl_5m: 5m | |
| ttl_1h: 1h |
🤖 Prompt for AI Agents
In src/libs/Anthropic/openapi.yaml around lines 5325 to 5334, the ttl schema
lacks a default and has a small typo in the description; update the ttl block to
add `default: 5m` and correct the description text from “one the following
values” to “one of the following values” so docs and behavior align.
| title: CacheCreation | ||
| required: | ||
| - ephemeral_1h_input_tokens | ||
| - ephemeral_5m_input_tokens | ||
| type: object | ||
| properties: | ||
| ephemeral_1h_input_tokens: | ||
| title: Ephemeral 1H Input Tokens | ||
| minimum: 0 | ||
| type: integer | ||
| description: The number of input tokens used to create the 1 hour cache entry. | ||
| default: 0 | ||
| ephemeral_5m_input_tokens: | ||
| title: Ephemeral 5M Input Tokens | ||
| minimum: 0 | ||
| type: integer | ||
| description: The number of input tokens used to create the 5 minute cache entry. | ||
| default: 0 |
There was a problem hiding this comment.
🛠️ Refactor suggestion
CacheCreation schema: mark fields as readOnly and freeze shape
These values are usage counters produced by the server; they shouldn’t be client-sent. Also, lock down the schema to prevent stray fields.
Proposed patch:
CacheCreation:
title: CacheCreation
required:
- ephemeral_1h_input_tokens
- ephemeral_5m_input_tokens
type: object
+ description: Token usage to create ephemeral cache entries in this response.
+ additionalProperties: false
properties:
ephemeral_1h_input_tokens:
title: Ephemeral 1H Input Tokens
minimum: 0
type: integer
description: The number of input tokens used to create the 1 hour cache entry.
default: 0
+ readOnly: true
ephemeral_5m_input_tokens:
title: Ephemeral 5M Input Tokens
minimum: 0
type: integer
description: The number of input tokens used to create the 5 minute cache entry.
default: 0
+ readOnly: true📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| title: CacheCreation | |
| required: | |
| - ephemeral_1h_input_tokens | |
| - ephemeral_5m_input_tokens | |
| type: object | |
| properties: | |
| ephemeral_1h_input_tokens: | |
| title: Ephemeral 1H Input Tokens | |
| minimum: 0 | |
| type: integer | |
| description: The number of input tokens used to create the 1 hour cache entry. | |
| default: 0 | |
| ephemeral_5m_input_tokens: | |
| title: Ephemeral 5M Input Tokens | |
| minimum: 0 | |
| type: integer | |
| description: The number of input tokens used to create the 5 minute cache entry. | |
| default: 0 | |
| title: CacheCreation | |
| required: | |
| - ephemeral_1h_input_tokens | |
| - ephemeral_5m_input_tokens | |
| type: object | |
| description: Token usage to create ephemeral cache entries in this response. | |
| additionalProperties: false | |
| properties: | |
| ephemeral_1h_input_tokens: | |
| title: Ephemeral 1H Input Tokens | |
| minimum: 0 | |
| type: integer | |
| description: The number of input tokens used to create the 1 hour cache entry. | |
| default: 0 | |
| readOnly: true | |
| ephemeral_5m_input_tokens: | |
| title: Ephemeral 5M Input Tokens | |
| minimum: 0 | |
| type: integer | |
| description: The number of input tokens used to create the 5 minute cache entry. | |
| default: 0 | |
| readOnly: true |
🤖 Prompt for AI Agents
In src/libs/Anthropic/openapi.yaml around lines 5343-5360, the CacheCreation
schema exposes server-produced counters as client-sent fields and allows extra
properties; mark both ephemeral_1h_input_tokens and ephemeral_5m_input_tokens
with readOnly: true, add additionalProperties: false to freeze the object shape,
and remove them from the required list (so clients are not forced to send these
server-only fields).
Summary by CodeRabbit
New Features
Documentation