Overview

The Context Cache API stores entire message prefixes — such as long system instructions, reference documents, or few-shot examples — so they can be reused across chat-completion requests. When a cache id is supplied, the gateway prepends the cached messages to the request before routing to the runtime, reducing repeated token costs and latency.

Base URL

This is the Allternit API data-plane node (your own paired or provisioned node).
The hosted Cloud API at api.allternit.com serves only POST /v1/chat/completions and GET /v1/models under /v1. The endpoints on this page are served by the Allternit API data-plane node (http://127.0.0.1:8013/v1 locally); they are not routed on the public Cloud API origin. See Cloud API.

Endpoints

Authentication

All requests require a virtual key in the Authorization header. See Authentication.

Create a context cache

Request body

Example request

Example response

List context caches

Retrieve a context cache

Delete a context cache

Use a context cache in chat completions

Pass the cache id in the context_cache_id field of a chat-completion request. The cached messages are prepended to the request messages before routing.

Cache lifecycle

  • Each create call returns a new cache id; caches are not deduplicated by content.
  • Caches expire automatically after ttl_seconds.
  • Deleting a cache removes it immediately; subsequent requests referencing it return a 404.

Error codes

  • Chat Completions — use context caches in completions
  • Cache — reusable prompt caches for single prompts
  • Files — upload documents for retrieval