Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Install and configure Anthropic Claude SDK authentication for Python and TypeScript. Use when setting up a new Claude API integration, configuring API keys, or initializing the Anthropic SDK in your project. Trigger with phrases like "install anthropic", "setup claude api", "anthropic auth", "configure anthropic API key", "claude sdk setup".
.claude/skills/jeremylongshore-anth-install-auth/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-09 | ✗→✓ | ▲ Improved | 48% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 73% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 56% | 0% |
| case-19 | ✗→✓ | ▲ Improved | -30% | 0% |
| case-20 | ✗→✓ | ▲ Improved | -1% | 0% |
Set up the official Anthropic SDK for Python or TypeScript and configure API key authentication. The SDK wraps the Claude Messages API at https://api.anthropic.com/v1/messages.
bash# Python pip install anthropic # TypeScript / Node.js npm install @anthropic-ai/sdk # With pnpm pnpm add @anthropic-ai/sdk
bash# Set environment variable (recommended) export ANTHROPIC_API_KEY="sk-ant-api03-..." # Or add to .env file echo 'ANTHROPIC_API_KEY=sk-ant-api03-your-key-here' >> .env # Verify it's set echo $ANTHROPIC_API_KEY | head -c 15 # Expected: sk-ant-api03-...
pythonimport anthropic client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY from env message = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=64, messages=[{"role": "user", "content": "Say hello in exactly 5 words."}] ) print(message.content[0].text) print(f"Model: {message.model}, Tokens: {message.usage.input_tokens}+{message.usage.output_tokens}")
typescriptimport Anthropic from '@anthropic-ai/sdk'; const client = new Anthropic(); // reads ANTHROPIC_API_KEY from env const message = await client.messages.create({ model: 'claude-sonnet-4-20250514', max_tokens: 64, messages: [{ role: 'user', content: 'Say hello in exactly 5 words.' }], }); if (message.content[0].type === 'text') { console.log(message.content[0].text); } console.log(`Stop reason: ${message.stop_reason}`);
anthropic for Python, @anthropic-ai/sdk for TS)ANTHROPIC_API_KEY configuredFor local Python development, install anthropic in the project virtual environment, export ANTHROPIC_API_KEY only in the current shell, then run the Step 3 script. Its successful text response confirms both package resolution and authentication without adding a secret to the repository. For a Node service, set the same variable in the deployment platform's secret manager and run the TypeScript check once in a non-production environment; keep the key out of source, logs, and client-side bundles.
| Error | HTTP Code | Cause | Solution | |-------|-----------|-------|----------| | authentication_error | 401 | Invalid or missing API key | Verify key starts with sk-ant-api03- | | permission_error | 403 | Key lacks required scope | Generate new key in Console | | not_found_error | 404 | Invalid API endpoint | Ensure SDK is latest version | | ModuleNotFoundError | N/A | SDK not installed | Run pip install anthropic or npm install @anthropic-ai/sdk | | connection_error | N/A | Network/firewall blocking | Ensure HTTPS to api.anthropic.com is allowed |
python# Custom base URL (for proxied environments) client = anthropic.Anthropic( api_key="sk-ant-...", base_url="https://your-proxy.internal.com/v1", timeout=60.0, max_retries=3 ) # With explicit headers client = anthropic.Anthropic( default_headers={"anthropic-beta": "messages-2024-12-19"} )
.env files with .gitignore exclusionAfter successful auth, proceed to anth-hello-world for your first Messages API call.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-07 | pass→pass | 2,775 | 2,767 | -0% | 1 | 1 | 0% | 342 | 1,405 | +311% | 0 | 0 | — |
case-01 | fail→fail | 10,573 | 7,560 | -28% | 1 | 1 | 0% | 2,318 | 2,806 | +21% | 0 | 0 | — |
case-02 | fail→fail | 8,101 | 7,975 | -2% | 1 | 1 | 0% | 1,709 | 2,987 | +75% | 0 | 0 | — |
case-03 | fail→fail | 14,553 | 13,047 | -10% | 1 | 1 | 0% | 2,775 | 3,724 | +34% | 0 | 0 | — |
case-04 | pass→pass | 8,645 | 8,432 | -2% | 1 | 1 | 0% | 1,993 | 2,960 | +49% | 0 | 0 | — |
case-05 | pass→pass | 11,012 | 11,002 | -0% | 1 | 1 | 0% | 2,445 | 3,359 | +37% | 0 | 0 | — |
case-06 | pass→pass | 8,989 | 12,277 | +37% | 1 | 1 | 0% | 1,912 | 3,749 | +96% | 0 | 0 | — |
case-08 | pass→pass | 3,179 | 1,551 | -51% | 1 | 1 | 0% | 465 | 1,351 | +191% | 0 | 0 | — |
case-09 | fail→pass | 5,833 | 2,801 | -52% | 1 | 1 | 0% | 1,071 | 1,585 | +48% | 0 | 0 | — |
case-10 | pass→pass | 11,040 | 3,690 | -67% | 1 | 1 | 0% | 2,060 | 1,791 | -13% | 0 | 0 | — |
case-11 | pass→pass | 2,218 | 1,763 | -21% | 1 | 1 | 0% | 345 | 1,354 | +292% | 0 | 0 | — |
case-12 | pass→pass | 10,032 | 4,677 | -53% | 1 | 1 | 0% | 1,885 | 2,032 | +8% | 0 | 0 | — |
case-13 | fail→pass | 5,312 | 2,882 | -46% | 1 | 1 | 0% | 962 | 1,662 | +73% | 0 | 0 | — |
case-14 | pass→pass | 2,222 | 1,221 | -45% | 1 | 1 | 0% | 321 | 1,319 | +311% | 0 | 0 | — |
case-15 | pass→pass | 3,665 | 1,958 | -47% | 1 | 1 | 0% | 628 | 1,455 | +132% | 0 | 0 | — |
case-16 | pass→pass | 5,661 | 1,701 | -70% | 1 | 1 | 0% | 1,129 | 1,385 | +23% | 0 | 0 | — |
case-17 | fail→pass | 4,777 | 1,307 | -73% | 1 | 1 | 0% | 845 | 1,317 | +56% | 0 | 0 | — |
case-18 | pass→pass | 6,259 | 3,409 | -46% | 1 | 1 | 0% | 1,175 | 1,772 | +51% | 0 | 0 | — |
case-19 | fail→pass | 8,481 | 1,392 | -84% | 1 | 1 | 0% | 1,871 | 1,311 | -30% | 0 | 0 | — |
case-20 | fail→pass | 7,423 | 1,518 | -80% | 1 | 1 | 0% | 1,353 | 1,340 | -1% | 0 | 0 | — |
case-21 | fail→pass | 5,176 | 1,568 | -70% | 1 | 1 | 0% | 858 | 1,413 | +65% | 0 | 0 | — |
case-22 | fail→pass | 7,945 | 1,367 | -83% | 1 | 1 | 0% | 1,352 | 1,311 | -3% | 0 | 0 | — |
case-23 | pass→pass | 9,107 | 3,251 | -64% | 1 | 1 | 0% | 1,780 | 1,673 | -6% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +30 percentage points is the difference between those two pass rates over the 23 comparable cases.
The publisher has shipped newer versions since this run, so these numbers describe v1, not the version currently listed.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.