Copilot Runtime adapter for Anthropic.
Example
import { CopilotRuntime, AnthropicAdapter } from "@copilotkit/runtime";
import Anthropic from "@anthropic-ai/sdk";
const copilotKit = new CopilotRuntime();
const anthropic = new Anthropic({
apiKey: "<your-api-key>",
});
return new AnthropicAdapter({
anthropic,
promptCaching: {
enabled: true,
debug: true
}
});
Constructor Parameters
anthropicAnthropic
An optional Anthropic instance to use. If not provided, a new instance will be created.
modelstring
The model to use.
promptCachingAnthropicPromptCachingConfig
Configuration for prompt caching. See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
maxInputTokensnumber
Optional maximum input token limit. Overrides the default limit used when trimming messages to fit the context window.