Skip to content

[ENHANCEMENT] Add Anthropic Batch API support for 50% cost savings #8667

@vgaggia

Description

@vgaggia

Problem (one or two sentences)

Problem

Anthropic offers a Batch API that processes requests asynchronously with 50% cost savings compared to standard API calls. Currently, Roo Code doesn't support this API, meaning users pay full price for all Anthropic requests even when they're willing to wait for async processing.

Proposed Solution

Add a toggle in Anthropic provider settings to enable Batch API mode. When enabled:

  • Requests are processed asynchronously (may take seconds to minutes)
  • Costs are reduced by 50%
  • User sees clean progress indicators during processing
  • All existing features (prompt caching, 1M context) remain compatible

User Benefit

Users working on non-urgent tasks (documentation, refactoring, analysis) can cut their Anthropic API costs in half by simply toggling a setting. This makes Roo Code significantly more cost-effective for budget-conscious developers.

Implementation Details

  • Add anthropicUseBatchApi boolean toggle to settings schema
  • Implement batch job creation, polling, and result retrieval
  • Show non-spammy progress updates (every 20s instead of every 5s)
  • Graceful error handling and timeout management
  • Full TypeScript typing and zero code duplication

Alignment with Roadmap

  • Reliability First: Expands robust support for AI providers with async options
  • Enhanced UX: Simple toggle, clear progress indicators, significant cost savings
  • Leading on Agent Performance: Maintains quality while dramatically reducing costs

Context (who is affected and when)

Users who want to reduce Anthropic API costs by 50% when they're willing to wait for asynchronous batch processing instead of real-time responses. Most useful for:

  • Users running large-scale evaluations
  • Teams processing multiple prompts in bulk
  • Cost-conscious users working on non-time-sensitive tasks
  • Anyone making repeated API calls where immediate results aren't critical

Desired behavior (conceptual, not technical)

Enable a settings toggle for Anthropic API users to use the Batch API, which processes requests asynchronously and reduces costs by 50%. Users should see clean progress updates while waiting, and the feature should work seamlessly with existing Anthropic features like prompt caching and 1M context window.

Constraints / preferences (optional)

  • Must maintain backward compatibility (default behavior unchanged)
  • Progress updates should not spam the chat
  • Should handle timeouts gracefully (max 10 minutes)
  • No code duplication in implementation

Request checklist

  • I've searched existing Issues and Discussions for duplicates
  • This describes a specific problem with clear context and impact

Roo Code Task Links (optional)

No response

Acceptance criteria (optional)

No response

Proposed approach (optional)

No response

Trade-offs / risks (optional)

No response

Metadata

Metadata

Assignees

Labels

Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.enhancementNew feature or request

Type

No type

Projects

Status

Issue [In Progress]

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions