DEV Community

Cover image for How to Use the Claude Agent SDK With Your Claude Plan?
Hassann
Hassann

Posted on • Originally published at apidog.com

How to Use the Claude Agent SDK With Your Claude Plan?

Anthropic is letting you run the Claude Agent SDK on your existing Claude subscription starting June 15, 2026. Previously, building with the Agent SDK required a separate API key and metered pay-as-you-go billing. From June 15 forward, eligible Claude plans include a monthly Agent SDK credit balance. No API key is required for plan-based SDK usage.

Try Apidog today

If you want to prototype a custom agent — for example, a deploy bot, research assistant, or triage tool — without adding a separate Anthropic API billing setup, this is the relevant change. Claude Pro includes $20/month of Agent SDK usage. Max 20x includes $200/month. Team Premium seats include $100/month.

What changed on June 15, 2026

Agent SDK usage can now draw from a monthly credit tied to your Claude plan. Before this change, Agent SDK usage billed through the Anthropic API with a separate console balance.

Monthly Agent SDK credits by plan:

Plan Monthly Agent SDK credit
Pro $20
Max 5x $100
Max 20x $200
Team Standard, per seat $20
Team Premium, per seat $100
Enterprise, usage-based $20
Enterprise Premium seat $200

Rules to account for before building:

  • Enterprise Standard seat members do not get a credit. They need an API key or a Premium seat.
  • Credits are per-user and non-transferable. A teammate’s unused credit cannot be pooled with yours.
  • Unused credits do not roll over. The balance resets at the end of the billing cycle.
  • One-time opt-in is required. The credit does not activate until you claim it once.
  • API key usage is separate. If you authenticate with ANTHROPIC_API_KEY, you are using the old API billing path.

What the credit covers

Covered by the Agent SDK credit:

  • Claude Agent SDK calls from your own Python or TypeScript projects
  • The claude -p command in Claude Code for non-interactive scripted runs
  • Claude Code GitHub Actions integration
  • Third-party apps that authenticate through the Agent SDK

Not covered:

  • Interactive Claude Code sessions
  • Claude web or mobile app conversations
  • Claude Cowork sessions

The practical takeaway: Agent SDK credit is for programmatic, automated, or non-interactive workloads. Your day-to-day Claude Code usage still uses your regular Claude plan limits, which Anthropic recently raised by 50% through July 13.

That separation is useful. You can prototype SDK-based agents without consuming the same Claude Code budget you rely on for daily development.

What happens when you run out of credit

The monthly credit covers a fixed dollar amount. Behavior after that depends on your extra usage setting:

  • Extra usage enabled: overages bill as pay-as-you-go at standard API rates.
  • Extra usage disabled: requests stop when the credit is exhausted until the next cycle.

For prototypes, leave extra usage disabled. You get a hard stop and avoid surprise charges.

For production automations that must continue running, enable extra usage.

The credit is always consumed first. You only pay overage rates after the monthly allowance is gone.

How to opt in

The credit is not enabled automatically. You need to claim it once.

  1. Log in to the Claude account that owns the subscription.
  2. Open the Claude Agent SDK plan settings from Anthropic’s official support article.
  3. Claim the Agent SDK credit.
  4. Confirm that the credit appears in your account settings.

On Team plans, each user must claim their own credit. Admins cannot claim credits on behalf of seat members.

Set up the Agent SDK

The Agent SDK is available for Python and TypeScript. For plan-based usage, authenticate through Claude Code instead of using a raw API key.

Python

Install the SDK:

pip install claude-agent-sdk
Enter fullscreen mode Exit fullscreen mode

Authenticate with Claude Code:

claude login
Enter fullscreen mode Exit fullscreen mode

Then create a minimal agent:

from claude_agent_sdk import Agent

agent = Agent(
    system_prompt="You are a code review assistant.",
)

response = agent.run("Review the diff in /tmp/patch.diff and flag concerns.")
print(response.text)
Enter fullscreen mode Exit fullscreen mode

For plan-based usage, do not set ANTHROPIC_API_KEY for this SDK flow. The SDK uses the local Claude Code credentials created by claude login.

TypeScript

Install the SDK:

npm install @anthropic-ai/claude-agent-sdk
Enter fullscreen mode Exit fullscreen mode

Authenticate:

claude login
Enter fullscreen mode Exit fullscreen mode

Create a minimal agent:

import { Agent } from "@anthropic-ai/claude-agent-sdk";

const agent = new Agent({
  systemPrompt: "You are a code review assistant.",
});

const response = await agent.run(
  "Review the diff in /tmp/patch.diff and flag concerns."
);

console.log(response.text);
Enter fullscreen mode Exit fullscreen mode

For CI runners, Docker containers, or remote dev boxes where local Claude Code credentials are unavailable, use the environment variable setup documented in the Agent SDK docs.

If claude login fails with config errors, this invalid custom3p enterprise config fix covers a common cause.

Use claude -p for scripted workflows

You can also use the Agent SDK credit without writing SDK code. The claude -p command runs Claude Code in non-interactive mode.

That makes it useful for:

  • CI pipelines
  • cron jobs
  • Git hooks
  • one-shot repo analysis
  • scripted code review checks

Example pre-commit hook:

#!/usr/bin/env bash
# .git/hooks/pre-commit

DIFF=$(git diff --cached)

claude -p "Review this diff for security issues, secret leaks, and breaking changes. Return PASS or FAIL with reasoning:\n\n$DIFF"
Enter fullscreen mode Exit fullscreen mode

Each claude -p invocation draws against the Agent SDK credit instead of the interactive Claude Code budget.

For more advanced agent loops, pair this with the /goal command and AGENTS.md context files.

GitHub Actions usage

The Claude Code GitHub Actions integration is also covered by the SDK credit.

If you use Claude for PR reviews, issue triage, or release note generation, workflow runs now draw from the Agent SDK credit on the user account that installed the GitHub App.

This matters for always-on automations such as Clawsweeper, the GitHub triage bot built on Claude Code, where usage previously depended on the API key attached to the app.

Build API-aware agents with Apidog

The Agent SDK becomes more useful when agents can safely call real APIs, query services, and orchestrate tools.

The failure mode is predictable: without an API contract, the agent guesses request shapes and payloads. That leads to invalid JSON, wrong parameters, and debugging time spent fixing hallucinated API calls.

A practical workflow is:

  1. Define the API contract in Apidog.

    Specify endpoints, request bodies, response schemas, auth, and examples.

  2. Export OpenAPI.

    Provide the OpenAPI spec to your agent as context.

  3. Wire the SDK to the real endpoints.

    Let the agent call APIs using the known schemas instead of guessing.

  4. Validate with the Apidog CLI.

    Run contract checks after agent actions to verify the API still behaves as expected.

For agents that use MCP servers, see the MCP server testing workflow with Apidog. For the broader contract-first approach, read the design-first API workflow guide.

You can also download Apidog to add a contract layer to Agent SDK projects.

When to keep using a separate API key

Plan-based credit is a good default for prototyping and small automations. A standalone API key still makes sense when you need:

  • Production-scale usage. Plan credits are fixed. A usage-based API key gives you a clearer billing path for larger workloads.
  • Shared org billing. API keys are not tied to one user’s monthly credit.
  • Enterprise Standard seat access. These seats do not receive Agent SDK credits.

The free Claude API access guide covers other Claude usage paths that do not require a Pro plan or paid API key.

Pre-flight checklist

Before building, verify:

  • [ ] Your plan is eligible: Pro, Max 5x, Max 20x, Team Standard, Team Premium, Enterprise usage-based, or Enterprise Premium seat
  • [ ] You claimed the one-time Agent SDK credit opt-in
  • [ ] You decided whether to enable extra usage
  • [ ] You ran claude login
  • [ ] You installed the Python or TypeScript SDK
  • [ ] Your test agent runs without ANTHROPIC_API_KEY
  • [ ] You checked your credit balance after the first few runs

FAQ

Do I need to remove ANTHROPIC_API_KEY?

For plan-based SDK usage, authenticate with claude login. The SDK uses Claude Code’s local credentials when available.

If you need ANTHROPIC_API_KEY for other tools, you do not necessarily need to remove it. Just verify that your SDK flow is using plan auth.

What counts as one request?

The credit is denominated in dollars, not request count.

Each SDK call bills at Anthropic’s published API rates. The balance decreases based on model calls, context tokens, output tokens, and tool usage. There is no separate per-request fee on top.

Can I share my credit with a teammate?

No. Credits are per-user and non-transferable.

What happens to my existing Anthropic API console balance?

It remains separate. API console balance still applies to API key workloads.

Is the Agent SDK the same as Claude Code?

No.

Claude Code is Anthropic’s CLI and IDE tooling. The Agent SDK is a Python/TypeScript library for building custom agents.

The credit covers:

  • Agent SDK usage
  • claude -p
  • Claude Code GitHub Actions
  • third-party apps using Agent SDK auth

Interactive Claude Code usage remains on your regular Claude plan limits.

Will my GitHub Actions bill change?

If your workflow uses the official Claude Code GitHub Actions integration and the installing user has claimed the credit, those runs draw against the SDK credit.

Does the credit work outside the Agent SDK and claude -p?

Only for the covered surfaces: Python/TypeScript SDK, claude -p, GitHub Actions, and third-party Agent SDK apps.

Other Claude usage falls back to your normal plan limits or API key billing, depending on how the request is authenticated.

Top comments (0)