Skip to content

AI spent going through the roof because requests are not cached #1009

Description

@FrankTub

Question

An analysis of my spent is showing that it is going to the roof. Below my tokens which is just going wild. I changed from Opus 4.6 to Opus 4.7 for most of my work on Jun 6.

Apr 13 ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 22.7M
Apr 20 █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 89.7M
Apr 27 ███████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 74.6M
May 04 ██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░ 147.5M
May 11 █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 7.8M
May 18 ███████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 111.6M
May 25 ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 43.5M
Jun 01 █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 87.3M
Jun 08 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ — gap
Jun 15 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ — gap
Jun 22 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ — gap
Jun 29 █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 91.6M
Jul 06 ████████████████████████████████████████░░ 408.2M ⚠️
Jul 13 ██████████████████████████████░░░░░░░░░░░░ 303.8M

I asked Cortex Code to analyze why this happens:

No, caching is NOT being applied to your REST API calls.

Here's the evidence:

Service | cache_read_input | cache_write_input | Caching Active? -- | -- | -- | -- REST API (your calls) | NULL | NULL | No Cortex Code Snowsight | 271,527+ per request | 8,123+ per request | Yes>

What This Means

  • Your REST API calls show only input and output in TOKENS_GRANULAR  no cache_read_input or cache_write_input fields at all.
  • By contrast, your Cortex Code Snowsight usage (this session) shows 96%+ cache hit rates (cache_read_input dominates input), meaning prompt caching is heavily utilized there.

Cost Impact

Prompt caching on Anthropic models typically gives 90% discount on cached input tokens. Your REST API calls average ~300K input tokens per request with zero caching. If even 70% of those tokens were cacheable (common for repeated system prompts, tool definitions, or conversation history):

  • Current: ~300K input tokens billed at full rate per request
  • With caching: ~90K at full rate + ~210K at 10% rate = effective ~111K tokens
  • Potential savings: ~63% on input token costs  roughly ~$4,000/month in savings at current volume

Environment

Altimate code 0.9.1
Connected to Snowflake Cortex
Opus 4.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions