Skip to content

feat:OpenAPI v135: remove tags; anthropic headers; CacheCreation/ttl#175

Merged
HavenDV merged 1 commit intomainfrom
bot/update-openapi_202508131816
Aug 13, 2025
Merged

feat:OpenAPI v135: remove tags; anthropic headers; CacheCreation/ttl#175
HavenDV merged 1 commit intomainfrom
bot/update-openapi_202508131816

Conversation

@HavenDV
Copy link
Copy Markdown
Contributor

@HavenDV HavenDV commented Aug 13, 2025

Summary by CodeRabbit

  • New Features

    • API version selection available via request header on multiple endpoints.
    • Opt-in beta features via header, including new context-1m-2025-08-07 option.
    • Expanded cache controls with TTL options (5m, 1h).
    • Usage reporting now includes cache creation metrics.
  • Documentation

    • OpenAPI spec updated, improving headers and beta coverage; some endpoint groupings simplified without changing request/response shapes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 13, 2025

Walkthrough

OpenAPI 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

Cohort / File(s) Summary
Spec Version and Tag Restructuring
src/libs/Anthropic/openapi.yaml
Bumped spec version 127 → 135; removed tags from numerous operations across /v1 messages, files, batches, token count, and beta variants.
Versioning and Beta Headers
src/libs/Anthropic/openapi.yaml
Added anthropic-version to multiple endpoints; added anthropic-beta to endpoints participating in beta flows.
Caching and Usage Schemas
src/libs/Anthropic/openapi.yaml
Added CacheCreation schema (ephemeral_1h_input_tokens, ephemeral_5m_input_tokens). CacheControlEphemeral adds ttl enum {5m, 1h} with rename map. Usage and BetaUsage now include cache_creation.
Beta Enumerations
src/libs/Anthropic/openapi.yaml
AnthropicBeta extended with context-1m-2025-08-07.
Path Metadata Adjustments
src/libs/Anthropic/openapi.yaml
Operation signatures unchanged; headers added; tags removed from: /v1/messages, /v1/complete, /v1/messages/batches..., /v1/files..., and their beta variants, plus count_tokens endpoints.

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)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Poem

Thump-thump! I stamp my change-log feet,
New headers hop, betas beat.
Caches burrow, TTLs set,
One million contexts? You bet!
Specs molt clean, tags drift away—
Carrot commits ship today! 🥕🐇

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202508131816

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@HavenDV HavenDV merged commit 7cfd2f8 into main Aug 13, 2025
2 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202508131816 branch August 13, 2025 18:17
@coderabbitai coderabbitai Bot changed the title feat:@coderabbitai feat:OpenAPI v135: remove tags; anthropic headers; CacheCreation/ttl Aug 13, 2025
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/libs/Anthropic/openapi.yaml (1)

8275-8276: New beta flag value added: context-1m-2025-08-07

Looks 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

📥 Commits

Reviewing files that changed from the base of the PR and between bd1a975 and 8c9c90e.

⛔ Files ignored due to path filters (74)
  • src/libs/Anthropic/Generated/Anthropic..JsonSerializerContext.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaDeleteFileV1FilesFileIdDelete.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaDownloadFileV1FilesFileIdContentGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaGetFileMetadataV1FilesFileIdGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaListFilesV1FilesGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesCancel.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesDelete.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesList.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesResults.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessageBatchesRetrieve.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessagesCountTokensPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaMessagesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaUploadFileV1FilesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.CompletePost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.DeleteFileV1FilesFileIdDelete.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.DownloadFileV1FilesFileIdContentGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.GetFileMetadataV1FilesFileIdGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.ListFilesV1FilesGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesCancel.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesDelete.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesList.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesResults.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessageBatchesRetrieve.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessagesCountTokensPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.MessagesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.UploadFileV1FilesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.AnthropicClient.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.FilesClient.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaDeleteFileV1FilesFileIdDelete.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaDownloadFileV1FilesFileIdContentGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaGetFileMetadataV1FilesFileIdGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaListFilesV1FilesGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesCancel.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesDelete.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesList.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesResults.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessageBatchesRetrieve.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessagesCountTokensPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaMessagesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.BetaUploadFileV1FilesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.CompletePost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.DeleteFileV1FilesFileIdDelete.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.DownloadFileV1FilesFileIdContentGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.GetFileMetadataV1FilesFileIdGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.ListFilesV1FilesGet.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesCancel.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesDelete.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesList.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesResults.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessageBatchesRetrieve.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessagesCountTokensPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.MessagesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.UploadFileV1FilesPost.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IAnthropicClient.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IFilesClient.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IMessageBatchesClient.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.IMessagesClient.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.ITextCompletionsClient.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.JsonConverters.CacheControlEphemeralTtl.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.JsonConverters.CacheControlEphemeralTtlNullable.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.MessageBatchesClient.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.MessagesClient.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.Models.AnthropicBetaEnum.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeral.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.Models.CacheControlEphemeralTtl.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.Models.CacheCreation.Json.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.Models.CacheCreation.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.Models.Usage.g.cs is excluded by !**/generated/**
  • src/libs/Anthropic/Generated/Anthropic.TextCompletionsClient.g.cs is 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 good

No concerns with the version update.


7996-8006: Making cache_creation required in Usage is a wire-level change—verify server always includes it

Marking this as required means every response must now contain usage.cache_creation. Ensure:

  • All code paths that return Usage populate cache_creation with 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.

Comment on lines +5325 to +5334
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

TTL property: add default and fix minor grammar

  • The description says “Defaults to 5m” but no default is set. Add default: 5m to 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.

Suggested change
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.

Comment on lines +5343 to +5360
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ 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.

Suggested change
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).

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