Claude API Actor – BYOK Anthropic Claude AI Proxy for Apify
Pricing
Pay per usage
Claude API Actor – BYOK Anthropic Claude AI Proxy for Apify
Call Anthropic's Claude API directly from any Apify Actor or automation workflow. This Actor is a lightweight, BYOK (Bring Your Own Key) proxy that lets you integrate Claude AI, including Opus, Sonnet, and Haiku, into your Apify scraping pipelines, data extraction workflows, and AI automation tasks
Pricing
Pay per usage
Rating
5.0
(1)
Developer
Harish Garg
Actor stats
0
Bookmarked
1
Total users
0
Monthly active users
5 hours ago
Last modified
Categories
Share
Run Anthropic's Claude API directly from any Apify Actor or automation workflow. This Actor is a lightweight, BYOK (Bring Your Own Key) proxy that lets you integrate Claude AI — including Claude Opus, Claude Sonnet, and Claude Haiku — into your Apify scraping pipelines, data extraction workflows, and AI automation tasks without installing extra libraries or managing HTTP clients.
Perfect for: web scraping + AI analysis, content classification, data extraction, LLM-powered automation, and multi-Actor AI pipelines on Apify.
Why Use This Claude API Apify Integration?
Most Apify scraping workflows need an AI step — classifying scraped content, extracting structured data, summarizing text, or generating output. Setting up the Anthropic SDK in every Actor is repetitive and slow. This Actor solves that:
- Call Claude from any Apify Actor — no Anthropic SDK needed in your own code
- BYOK — use your own Anthropic API key; you're billed directly by Anthropic
- All Claude models supported — Opus 4.x, Sonnet 4.x, Haiku (latest versions)
- Flexible API key storage — pass per-run or store persistently in Apify Key-Value Store
- Drop-in AI step for multi-Actor Apify workflows
How to Call Claude API from Apify – Setup
Step 1: Get an Anthropic API Key
Sign up at console.anthropic.com and generate an API key. You will be billed by Anthropic based on your usage — this Actor does not add any markup.
Step 2: Store or Provide Your Anthropic API Key
You have two options:
Option A: Pass it directly in the input (per-run, simplest)
Include anthropicApiKey in your JSON input. No configuration needed — works immediately.
Option B: Store it in Apify Key-Value Store (recommended for recurring use)
- Go to Apify Console → Storage → Key-Value Stores
- Open the Actor's default Key-Value Store (auto-created on first run)
- Add a record with key:
ANTHROPIC_API_KEYand your Anthropic API key as the value
Key resolution order:
anthropicApiKeyin input (if provided)ANTHROPIC_API_KEYin default Key-Value Store- Error with clear message if neither is found
Input Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
messages | array | ✅ Yes | — | Messages array in standard Anthropic API format |
anthropicApiKey | string | ❌ No | — | Your Anthropic API key (or use KVS) |
model | string | ❌ No | claude-sonnet-4-6 | Claude model to use |
system | string | ❌ No | — | System prompt |
max_tokens | integer | ❌ No | 1024 | Max tokens to generate |
temperature | number | ❌ No | 1.0 | Response randomness (0.0–1.0) |
Example Input
{"messages": [{"role": "user","content": "Summarize the following product reviews and identify the top 3 complaints."}],"model": "claude-sonnet-4-6","max_tokens": 1024,"system": "You are a helpful product analyst."}
Which Claude Model Should I Use?
| Model | Speed | Cost | Best For |
|---|---|---|---|
claude-opus-476 | Slowest | Highest | Complex reasoning, long-form analysis, highest quality output |
claude-sonnet-4-6 | Balanced | Medium | Default choice — best balance of speed and intelligence |
claude-haiku-4-5 | Fastest | Lowest | High-volume tasks: classification, extraction, summarization |
Recommendation: Start with claude-sonnet-4-6. Switch to Haiku for scale, Opus for quality-critical tasks.
Output
The Actor returns the full Anthropic API JSON response, saved to:
- The default Dataset (one record per run)
- The
OUTPUTkey in the default Key-Value Store (for direct actor-to-actor access)
Example Output
{"id": "msg_01XyZ...","type": "message","role": "assistant","content": [{"type": "text","text": "The top 3 complaints are: 1) slow delivery..."}],"model": "claude-sonnet-4-6","usage": {"input_tokens": 34,"output_tokens": 218}}
Integrate Claude into Apify Workflows – Actor-to-Actor Usage
The most powerful use case: calling this Claude API Actor from inside another Apify Actor to add AI processing to your scraping or automation pipeline.
JavaScript / Node.js Example
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: process.env.APIFY_TOKEN });// Call Claude API Actor from your own Apify Actorconst run = await client.actor('YOUR_USERNAME/claude-api-actor').call({messages: [{role: 'user',content: `Classify this product review as positive, negative, or neutral: "${reviewText}"`}],model: 'claude-haiku-4-5-20251001',max_tokens: 128});// Read Claude's responseconst { items } = await client.dataset(run.defaultDatasetId).listItems();const text = items[0].content[0].text;
Python Example
from apify_client import ApifyClientclient = ApifyClient(token=os.environ["APIFY_TOKEN"])# Call Claude API Actor from your Apify scraping pipelinerun = client.actor("YOUR_USERNAME/claude-api-actor").call(run_input={"messages": [{"role": "user","content": f"Extract the price and product name from this text: {scraped_text}"}],"model": "claude-sonnet-4-6","max_tokens": 256})items = client.dataset(run["defaultDatasetId"]).list_items().itemstext = items[0]["content"][0]["text"]
Common Use Cases
- Web scraping + AI analysis — scrape product pages, pass content to Claude for structured extraction
- Content classification — classify scraped articles, reviews, or listings at scale
- Data extraction from unstructured text — pull prices, names, dates from raw HTML or text
- LLM-powered automation pipelines — chain multiple Apify Actors with Claude as the AI reasoning step
- Summarization — summarize large scraped datasets before storing or exporting
- Sentiment analysis — analyze customer reviews, social media posts, or feedback at Apify scale
Error Reference
| Error | Cause | Fix |
|---|---|---|
No API key found | Key missing from both input and KVS | Add anthropicApiKey to input or set up KVS |
401 Unauthorized | Invalid or expired Anthropic API key | Regenerate key at console.anthropic.com |
400 Bad Request | Invalid model name or malformed messages | Check model name against the table above |
429 Too Many Requests | Anthropic rate limit hit | Reduce request frequency or upgrade Anthropic plan |
Frequently Asked Questions
Is my Anthropic API key secure? Yes. Store your key in the Apify Key-Value Store rather than passing it in every input. It is encrypted at rest by Apify and never logged by this Actor.
Which Claude model should I use for web scraping workflows?
Use claude-haiku-4-5-20251001 for high-volume, simple extraction tasks. Use claude-sonnet-4-6 for more complex analysis. Reserve claude-opus-4-6 for tasks that require maximum reasoning quality.
Can I use this Actor without knowing the Anthropic API? Yes. The input format mirrors the official Anthropic API, but you don't need to understand HTTP clients or authentication — just provide your key and messages.
Does this Actor cost anything beyond Anthropic's API fees? You pay Apify's standard Actor compute costs and Anthropic's API usage fees directly. This Actor does not add any markup.
What's the difference between passing the API key in input vs Key-Value Store? Input is simpler for one-off runs. Key-Value Store is better for recurring workflows — store once, never repeat it in your input JSON again.