anthropic-api
anthropic-api
Purpose
This skill integrates with Anthropic's Claude API to leverage advanced AI models for tasks requiring tool use and extended context, enabling complex interactions like function calling and long-form processing.
When to Use
Use this skill for scenarios involving sophisticated AI reasoning, such as analyzing large documents, generating code with tools, or handling multi-step workflows. It's ideal when standard models fall short, like in research, automation, or interactive applications.
Key Capabilities
- Access Claude models (e.g., claude-3-haiku, claude-3-sonnet) via API for text generation and completion.
- Support tool use, allowing the AI to call external functions based on JSON-defined tools.
- Handle extended contexts up to 200K tokens for processing long inputs.
- Real-time streaming responses for interactive sessions.
- Fine-grained control over parameters like temperature (0.0-1.0) and top_p (0-1).
Usage Patterns
To use this skill in OpenClaw, first set the API key as an environment variable (e.g., export ANTHROPIC_API_KEY=your_key). Invoke the skill via OpenClaw's execute command, passing parameters like model and prompt. For HTTP-based integration, make POST requests to the API endpoint. Always include authentication headers. Structure requests with JSON bodies containing "messages" array for conversation history and "tools" for function definitions.