Skip to content
HALOWERK

Denkwerk

prompt cache layout

Takes the prompt as segments with a change frequency (never, daily, per_session, per_request), detects volatile content such as timestamps, dates, UUIDs and epoch values inside supposedly stable segments, reorders segments so the longest stable prefix comes first (Anthropic: tools, system, messages order is kept), places up to four breakpoints at stability boundaries, checks the documented minimum cacheable length and estimates the input cost factor for N requests sharing the prefix. Rules.

POST https://denk.halowerk.com/v1/prompt-cache-layout

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
providerstringYesTarget provider.
modelstringNoModel id, e.g. claude-sonnet-4-6, gpt-5.6-sol, gemini-2.5-flash. Determines minimum length and multipliers.
segmentsarrayYesPrompt parts in their current order.
requests_per_cache_lifetimeintegerNoRequests that share the prefix within one cache lifetime.
ttlstringNoAnthropic 5m vs 1h, OpenAI (GPT-5.6+) 30m vs 12h.
cache_read_multipliernumberNoOverride or supply the cache-read price factor.
cache_write_multipliernumberNoOverride the cache-write price factor.
encodingstringNo
Show full input schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "provider",
    "segments"
  ],
  "properties": {
    "provider": {
      "type": "string",
      "enum": [
        "anthropic",
        "openai",
        "gemini"
      ],
      "description": "Target provider."
    },
    "model": {
      "type": "string",
      "maxLength": 80,
      "description": "Model id, e.g. claude-sonnet-4-6, gpt-5.6-sol, gemini-2.5-flash. Determines minimum length and multipliers."
    },
    "segments": {
      "type": "array",
      "minItems": 1,
      "maxItems": 64,
      "description": "Prompt parts in their current order.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "text",
          "changes"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "role": {
            "type": "string",
            "enum": [
              "tools",
              "system",
              "developer",
              "user",
              "assistant",
              "document",
              "example"
            ],
            "default": "user"
          },
          "text": {
            "type": "string",
            "maxLength": 400000
          },
          "changes": {
            "type": "string",
            "enum": [
              "never",
              "daily",
              "per_session",
              "per_request"
            ],
            "description": "How often this segment changes between requests."
          },
          "pinned": {
            "type": "boolean",
            "default": false,
            "description": "Keep this segment at its position."
          }
        }
      }
    },
    "requests_per_cache_lifetime": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1000000,
      "default": 10,
      "description": "Requests that share the prefix within one cache lifetime."
    },
    "ttl": {
      "type": "string",
      "enum": [
        "default",
        "long"
      ],
      "default": "default",
      "description": "Anthropic 5m vs 1h, OpenAI (GPT-5.6+) 30m vs 12h."
    },
    "cache_read_multiplier": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Override or supply the cache-read price factor."
    },
    "cache_write_multiplier": {
      "type": "number",
      "minimum": 1,
      "maximum": 5,
      "description": "Override the cache-write price factor."
    },
    "encoding": {
      "type": "string",
      "enum": [
        "o200k_base",
        "cl100k_base"
      ],
      "default": "o200k_base"
    }
  }
}

Open original schema

Published input example

{
  "provider": "anthropic",
  "model": "claude-sonnet-4-6",
  "segments": [
    {
      "id": "question",
      "role": "user",
      "text": "What is the refund policy?",
      "changes": "per_request"
    },
    {
      "id": "policy",
      "role": "system",
      "text": "You are the support assistant of Lagertechnik Nord GmbH. Refunds are possible within 30 days.",
      "changes": "never"
    }
  ]
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-17 UTC.

More endpoints in this hub

All endpoints in this hub โ†’