Skip to main content
The TypeScript SDK and docs are currently in beta. Report issues on GitHub.

Example Usage

import { AnthropicDocumentBlockParam } from "@openrouter/sdk/models";

let value: AnthropicDocumentBlockParam = {
  source: {
    data: "Hello, world!",
    mediaType: "text/plain",
    type: "text",
  },
  type: "document",
};

Fields

FieldTypeRequiredDescriptionExample
cacheControlmodels.AnthropicCacheControlDirective:heavy_minus_sign:Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.{"type": "ephemeral"}
citationsmodels.AnthropicDocumentBlockParamCitations:heavy_minus_sign:N/A
contextstring:heavy_minus_sign:N/A
sourcemodels.AnthropicDocumentBlockParamSourceUnion:heavy_check_mark:N/A
titlestring:heavy_minus_sign:N/A
type”document”:heavy_check_mark:N/A