claude-api

Warn

Audited by Runlayer on Mar 4, 2026

Risk Level: MEDIUM
Scan Summary
Max Score
85%
Files
26
Flagged
12
Chunks
34
Flagged Files (12)
claude-api/python/claude-api/README.mdMEDIUM
85.0%

Malicious tool definition detected

Use Token Counting Before Requests ```python count_response = client.messages.count_tokens( model="claude-opus-4-6", messages=messages, system=system ) estimated_input_cost = count_response.input_tokens * 0.000005 # $5/1M tokens print(f"Estimated input cost: ${estimated_input_cost:.4f}") ``` --- ## Retry with Exponential Backoff > **Note:** The Anthropic SDK automatically retries rate limit (429) and server errors (5xx) with exponential backoff.

claude-api/typescript/claude-api/README.mdMEDIUM
80.7%

Tool passed security scan

Malicious tool definition detected

Use Token Counting Before Requests ```typescript const countResponse = await client.messages.countTokens({ model: "claude-opus-4-6", messages: messages, system: system, }); const estimatedInputCost = countResponse.input_tokens * 0.000005; // $5/1M tokens console.log(`Estimated input cost: $${estimatedInputCost.toFixed(4)}`); ```

claude-api/python/claude-api/tool-use.mdMEDIUM
75.6%

Tool passed security scan

Malicious tool definition detected

memory = MyMemoryTool() # Use with tool runner runner = client.beta.messages.tool_runner( model="claude-opus-4-6", max_tokens=2048, tools=[memory], messages=[{"role": "user", "content": "Remember my preferences"}], ) for message in runner: print(message) ``` For full implementation examples, use WebFetch: - `https://github.com/anthropics/anthropic-sdk-python/blob/main/examples/memory/basic.py` --- ## Structured Outputs ### JSON Outputs (Pydantic — Recommended) ```python from pydantic import Base

claude-api/python/claude-api/batches.mdLOW
74.1%

Malicious tool definition detected

print(f"Status: {cancelled.processing_status}") # "canceling" ``` --- ## Batch with Prompt Caching ```python shared_system = [ {"type": "text", "text": "You are a literary analyst."}, { "type": "text", "text": large_document_text, # Shared across all requests "cache_control": {"type": "ephemeral"} } ] message_batch = client.messages.batches.create( requests=[ Request( custom_id=f"analysis-{i}", params=MessageCreateParamsNonStreaming( model="claude-opus-4-6", max_tokens=1024, system=shared_syst

claude-api/SKILL.mdLOW
73.1%

Tool passed security scan

Malicious tool definition detected

**Critical:** Append `response.content` (not just the text) back to your messages on every turn. Compaction blocks in the response must be preserved — the API uses them to replace the compacted history on the next request. Extracting only the text string and appending that will silently lose the compaction state. See `{lang}/claude-api/README.md` (Compaction section) for code examples.

claude-api/csharp/claude-api.mdLOW
69.8%

Tool passed security scan

claude-api/typescript/claude-api/tool-use.mdLOW
68.2%

Tool passed security scan

claude-api/shared/tool-use-concepts.mdLOW
68.1%

Tool passed security scan

claude-api/typescript/claude-api/batches.mdLOW
67.0%

Tool passed security scan

claude-api/typescript/claude-api/files-api.mdLOW
57.5%

Tool passed security scan

claude-api/php/claude-api.mdLOW
53.3%

Tool passed security scan

claude-api/java/claude-api.mdLOW
51.7%

Tool passed security scan

Passed Files (14)Click to expand
claude-api/python/claude-api/files-api.mdOK
49.5%

Tool passed security scan

claude-api/curl/examples.mdOK
46.9%

Tool passed security scan

claude-api/go/claude-api.mdOK
40.6%

Tool passed security scan

claude-api/LICENSE.txtOK
38.8%

Tool passed security scan

claude-api/shared/live-sources.mdOK
38.8%

Tool passed security scan

claude-api/ruby/claude-api.mdOK
38.0%

Tool passed security scan

claude-api/python/claude-api/streaming.mdOK
34.3%

Tool passed security scan

claude-api/shared/models.mdOK
28.8%

Tool passed security scan

claude-api/python/agent-sdk/patterns.mdOK
27.9%

Tool passed security scan

claude-api/typescript/agent-sdk/patterns.mdOK
14.4%

Tool passed security scan

claude-api/typescript/claude-api/streaming.mdOK
9.4%

Tool passed security scan

claude-api/typescript/agent-sdk/README.mdOK
8.0%

Tool passed security scan

claude-api/python/agent-sdk/README.mdOK
5.8%

Tool passed security scan

claude-api/shared/error-codes.mdOK
3.7%

Tool passed security scan

Audit Metadata
Max File Score
85%
Classification
UNKNOWN_SERVER
Files Scanned
26
Files Flagged
12
Chunks Analyzed
34
Analyzed
Mar 4, 2026, 08:08 PM
Security Audit — runlayer — claude-api