Claude API Actor – BYOK Anthropic Claude AI Proxy for Apify avatar

Claude API Actor – BYOK Anthropic Claude AI Proxy for Apify

Pricing

Pay per usage

Go to Apify Store
Claude API Actor – BYOK Anthropic Claude AI Proxy for Apify

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

Harish Garg

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

5 hours ago

Last modified

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)

  1. Go to Apify Console → Storage → Key-Value Stores
  2. Open the Actor's default Key-Value Store (auto-created on first run)
  3. Add a record with key: ANTHROPIC_API_KEY and your Anthropic API key as the value

Key resolution order:

  1. anthropicApiKey in input (if provided)
  2. ANTHROPIC_API_KEY in default Key-Value Store
  3. Error with clear message if neither is found

Input Schema

FieldTypeRequiredDefaultDescription
messagesarray✅ YesMessages array in standard Anthropic API format
anthropicApiKeystring❌ NoYour Anthropic API key (or use KVS)
modelstring❌ Noclaude-sonnet-4-6Claude model to use
systemstring❌ NoSystem prompt
max_tokensinteger❌ No1024Max tokens to generate
temperaturenumber❌ No1.0Response 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?

ModelSpeedCostBest For
claude-opus-476SlowestHighestComplex reasoning, long-form analysis, highest quality output
claude-sonnet-4-6BalancedMediumDefault choice — best balance of speed and intelligence
claude-haiku-4-5FastestLowestHigh-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 OUTPUT key 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 Actor
const 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 response
const { items } = await client.dataset(run.defaultDatasetId).listItems();
const text = items[0].content[0].text;

Python Example

from apify_client import ApifyClient
client = ApifyClient(token=os.environ["APIFY_TOKEN"])
# Call Claude API Actor from your Apify scraping pipeline
run = 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().items
text = 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

ErrorCauseFix
No API key foundKey missing from both input and KVSAdd anthropicApiKey to input or set up KVS
401 UnauthorizedInvalid or expired Anthropic API keyRegenerate key at console.anthropic.com
400 Bad RequestInvalid model name or malformed messagesCheck model name against the table above
429 Too Many RequestsAnthropic rate limit hitReduce 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.