> **Building with AI coding agents?** Install the authstack plugin with one command. This equips your agent with accurate Scalekit implementation patterns.
>
> **Recommended** (the `-y` flags skip prompts, so the command runs without an interactive terminal):
> ```bash
> npx -y @scalekit-inc/cli setup -y
> ```
>
> Global:
> ```bash
> npm install -g @scalekit-inc/cli
> scalekit setup -y
> ```
>
> Supports Claude Code, Cursor, GitHub Copilot, Codex + skills for other Agent Skills-compatible agents in `~/.agents/skills`.
> Skills: integrate-agentkit, implement-saaskit, add-mcp-oauth, implement-sso, implement-scim.
> [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Connect AI agents to Anthropic

The Anthropic connector lets your AI agent act in each user's Anthropic account. Each user connects their own Anthropic API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 13 tools.

**Authentication:** API Key
**Categories:** AI
**Tools:** 13: 8 read, 3 write, 2 destructive
**Users sign in with:** API key
**Built by:** Scalekit connector
**Try it:** [Playground in the Scalekit dashboard](https://app.scalekit.com/ws/signup?sk_intent=playground&provider=ANTHROPIC)

## Setup

1. ### Install the SDK

   **Node.js**

   ```bash
   npm install @scalekit-sdk/node dotenv
   ```

   **Python**

   ```bash
   pip install scalekit-sdk-python python-dotenv
   ```

2. ### Set your credentials

   Add your Scalekit credentials to your `.env` file. Find values in **[app.scalekit.com](https://app.scalekit.com)** > **Developers** > **API Credentials**.

   ```sh title=".env"
   SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
   SCALEKIT_CLIENT_ID=<your-client-id>
   SCALEKIT_CLIENT_SECRET=<your-client-secret>
   ```

3. ### Create the Anthropic connection

   In **AgentKit > Connections**, create an Anthropic connection. The name you give it is the `connection_name` your code passes. See [Configure connections](/agentkit/connections/).

4. ### Authorize a user and make your first call

   **Node.js** (`quickstart.mts`)

   ```typescript
   import { ScalekitClient } from '@scalekit-sdk/node'
   import 'dotenv/config'
   import { createInterface } from 'node:readline/promises'

   const scalekit = new ScalekitClient(
     process.env.SCALEKIT_ENVIRONMENT_URL,
     process.env.SCALEKIT_CLIENT_ID,
     process.env.SCALEKIT_CLIENT_SECRET,
   )
   const actions = scalekit.actions

   const connector = 'anthropic'
   const identifier = 'user_123'

   // Generate an authorization link for the user
   const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
   console.log('Authorize Anthropic:', link)
   const rl = createInterface({ input: process.stdin, output: process.stdout })
   await rl.question('Press Enter after authorizing...')
   rl.close()

   // Make your first call
   const result = await actions.executeTool({
     connector,
     identifier,
     toolName: 'anthropic_list_files',
     toolInput: {},
   })
   console.log(result)
   ```

   ```bash
   npx tsx quickstart.mts
   ```

   **Python** (`quickstart.py`)

   ```python
   import os
   from scalekit import ScalekitClient
   from dotenv import load_dotenv
   load_dotenv()

   scalekit_client = ScalekitClient(
       env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"),
       client_id=os.getenv("SCALEKIT_CLIENT_ID"),
       client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),
   )
   actions = scalekit_client.actions

   connection_name = "anthropic"
   identifier = "user_123"

   # Generate an authorization link for the user
   link_response = actions.get_authorization_link(
       connection_name=connection_name,
       identifier=identifier,
   )
   print("Authorize Anthropic:", link_response.link)
   input("Press Enter after authorizing...")

   # Make your first call
   result = actions.execute_tool(
       tool_input={},
       tool_name="anthropic_list_files",
       connection_name=connection_name,
       identifier=identifier,
   )
   print(result)
   ```

   ```bash
   python quickstart.py
   ```

   Each user opens the link once and enters their Anthropic credentials there. See [Authorize a user](/agentkit/tools/authorize/) for the full flow and statuses.

## Tools

Pass the exact name to `execute_tool`, with an input like each tool's example. To ask for a tool that's missing, use the [request form](https://scalekitsupport.portal.usepylon.com/forms/request-a-connector-tool).

**Node.js**

```typescript
const result = await actions.executeTool({
  toolName: 'anthropic_count_tokens',
  toolInput: {
    messages: [{
        role: 'user',
        content: 'Hello, Claude',
      }],
    model: '<model>',
  },
  connector: 'anthropic',
  identifier: 'user_123',
})
```

**Python**

```python
result = actions.execute_tool(
    tool_name="anthropic_count_tokens",
    tool_input={
        "messages": [{
                "role": "user",
                "content": "Hello, Claude",
            }],
        "model": "<model>",
    },
    connection_name="anthropic",
    identifier="user_123",
)
```

`result.data` is the app's response as JSON, and `result.execution_id` (`executionId` in Node.js) is the ID of the call.

### `anthropic_count_tokens`

Count Message Tokens · Read-only

Count the input tokens a message request would use, without running the model.
Returns input_tokens, the total across messages, system prompt and tools.
Use before anthropic_create_message to check a prompt against context limits or estimate cost. It does not generate text and is not billed as a completion.

Read only: yes. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `messages` (`array`, required): Conversation turns, oldest first, alternating user and assistant roles. Each turn has a role (user or assistant) and content, which is either a plain string or an array of content blocks. Example: [{"role": "user", "content": "Hello, Claude"}]. A final assistant turn is treated as a prefill on models that allow it.
- `model` (`string`, required): Model id to run, for example claude-sonnet-5-5, claude-opus-5-5 or claude-haiku-5-5. Use anthropic_list_models to see the ids your key can use.
- `output_config` (`object`, optional): Output settings. Set effort to low, medium, high, xhigh or max to trade thoroughness for speed, and format to {"type": "json_schema", "schema": {...}} to request structured JSON output. Example: {"effort": "medium"}.
- `system` (`string`, optional): System prompt that sets context, role or instructions for the model. A plain string, or an array of text blocks such as [{"type": "text", "text": "You are a concise assistant."}].
- `thinking` (`object`, optional): Extended thinking configuration. Use {"type": "adaptive"} to let Claude decide when to think, {"type": "enabled", "budget_tokens": 2048} for a fixed thinking budget (at least 1024 and below max_tokens), or {"type": "disabled"}. Which types a model accepts depends on the model.
- `tool_choice` (`object`, optional): Controls how the model uses the supplied tools. Use {"type": "auto"} to let the model decide, {"type": "any"} to force some tool call, {"type": "tool", "name": "get_weather"} to force one tool, or {"type": "none"} to forbid tool calls.
- `tools` (`array`, optional): Client tool definitions the model may call. Each tool has a name, a description, and an input_schema that is a JSON Schema object. Example: [{"name": "get_weather", "description": "Get the weather for a city", "input_schema": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}].

Example input: `{"messages":[{"role":"user","content":"Hello, Claude"}],"model":"<model>"}`

### `anthropic_get_file_metadata`

Get File Metadata · Read-only

Get metadata for one uploaded file by id.
Returns id, filename, mime_type, size_bytes, created_at, downloadable and expires_at; not the file content.
Use after anthropic_list_files to inspect a file.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `file_id` (`string`, required): Id of the file, starting with file_. Returned by anthropic_list_files.

Example input: `{"file_id":"<file_id>"}`

### `anthropic_get_message_batch`

Get Message Batch · Read-only

Get the status of one message batch by id.
Returns processing_status (in_progress, canceling or ended), request_counts, timestamps and results_url once ended.
Use to poll a batch after anthropic_create_message_batch. Once ended, use anthropic_get_message_batch_results to read the outputs.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `message_batch_id` (`string`, required): Id of the message batch, starting with msgbatch_. Returned by anthropic_create_message_batch and anthropic_list_message_batches.

Example input: `{"message_batch_id":"<message_batch_id>"}`

### `anthropic_get_message_batch_results`

Get Message Batch Results · Read-only

Fetch the results of a finished message batch as JSON Lines, one result per request.
Returns lines with custom_id and a result of succeeded (with the message), errored, canceled or expired; order may differ from the request order.
Use after anthropic_get_message_batch shows processing_status ended, and match lines to requests by custom_id.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `message_batch_id` (`string`, required): Id of the message batch, starting with msgbatch_. Returned by anthropic_create_message_batch and anthropic_list_message_batches.

Example input: `{"message_batch_id":"<message_batch_id>"}`

### `anthropic_get_model`

Get Model · Read-only

Get details for one Claude model by id or alias.
Returns id, display_name, created_at, lifecycle, deprecation and retirement dates, max_input_tokens, max_tokens and capabilities.
Use after anthropic_list_models to check limits or capabilities of a specific model.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `model_id` (`string`, required): Model id or alias, for example claude-sonnet-5-5.

Example input: `{"model_id":"<model_id>"}`

### `anthropic_list_files`

List Files · Read-only

List files uploaded to the workspace through the Files API.
Returns file metadata (id, filename, mime_type, size_bytes, created_at, downloadable, expires_at) and next_page cursor.
Use to find a file id. Use anthropic_get_file_metadata for one file.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `limit` (`integer`, optional): Number of files per page, 1 to 1000. Defaults to 20.
- `page` (`string`, optional): Opaque page cursor from the next_page field of a previous response, starting with page_.

Example input: `{}`

### `anthropic_list_message_batches`

List Message Batches · Read-only

List message batches in the workspace, newest first.
Returns batch objects with id, processing_status and request_counts, plus pagination cursors (has_more, first_id, last_id).
Use to find a batch id. Use anthropic_get_message_batch for one batch.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `after_id` (`string`, optional): Batch id cursor. Returns the page after this batch. Use last_id from the previous response.
- `before_id` (`string`, optional): Batch id cursor. Returns the page before this batch. Use first_id from the previous response.
- `limit` (`integer`, optional): Number of batches per page, 1 to 1000. Defaults to 20.

Example input: `{}`

### `anthropic_list_models`

List Models · Read-only

List the Claude models available to the API key, newest first.
Returns model id, display_name, created_at, lifecycle, token limits, capabilities, and pagination cursors (has_more, first_id, last_id).
Use to discover valid model ids. Use anthropic_get_model for one model.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `after_id` (`string`, optional): Model id cursor. Returns the page after this model. Use last_id from the previous response.
- `before_id` (`string`, optional): Model id cursor. Returns the page before this model. Use first_id from the previous response.
- `lifecycle` (`string`, optional): Only list models in this lifecycle stage. Without it, active and deprecated models are listed and retired models are hidden. One of: `active`, `deprecated`, `retired`.
- `limit` (`integer`, optional): Number of models per page, 1 to 1000. Defaults to 20.

Example input: `{}`

### `anthropic_cancel_message_batch`

Cancel Message Batch · Write

Cancel a message batch that is still processing.
Returns the batch object with processing_status canceling; requests already running may still finish and the rest end as canceled.
Use to stop a batch you no longer need. Use anthropic_delete_message_batch to remove a finished batch.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `message_batch_id` (`string`, required): Id of the message batch, starting with msgbatch_. Returned by anthropic_create_message_batch and anthropic_list_message_batches.

Example input: `{"message_batch_id":"<message_batch_id>"}`

### `anthropic_create_message`

Create Message · Write

Send a conversation to a Claude model and get the next assistant message, with optional system prompt, tools, thinking and structured output.
Returns the message id, model, content blocks, stop_reason and token usage; non-streaming only.
Use this for a single synchronous completion. Use anthropic_create_message_batch to run many requests asynchronously, and anthropic_count_tokens to size a prompt first.
Charges apply to the API key's account for the tokens used.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `max_tokens` (`integer`, required): Maximum number of tokens to generate before stopping. The model may stop earlier. Example: 1024.
- `messages` (`array`, required): Conversation turns, oldest first, alternating user and assistant roles. Each turn has a role (user or assistant) and content, which is either a plain string or an array of content blocks. Example: [{"role": "user", "content": "Hello, Claude"}]. A final assistant turn is treated as a prefill on models that allow it.
- `model` (`string`, required): Model id to run, for example claude-sonnet-5-5, claude-opus-5-5 or claude-haiku-5-5. Use anthropic_list_models to see the ids your key can use.
- `metadata_user_id` (`string`, optional): Opaque external id for the end user, such as a UUID or hash, used to help detect abuse. Do not use names or emails. Maximum 512 characters.
- `output_config` (`object`, optional): Output settings. Set effort to low, medium, high, xhigh or max to trade thoroughness for speed, and format to {"type": "json_schema", "schema": {...}} to request structured JSON output. Example: {"effort": "medium"}.
- `service_tier` (`string`, optional): Use auto to take priority capacity when your account has it, or standard_only to stay on standard capacity. One of: `auto`, `standard_only`.
- `stop_sequences` (`array`, optional): Custom strings that make the model stop generating when produced. Example: ["END"].
- `system` (`string`, optional): System prompt that sets context, role or instructions for the model. A plain string, or an array of text blocks such as [{"type": "text", "text": "You are a concise assistant."}].
- `temperature` (`number`, optional): Randomness from 0.0 to 1.0. Models released after Claude Opus 4.6 only accept 1.0 and reject other values with a 400 error, so leave this empty for them.
- `thinking` (`object`, optional): Extended thinking configuration. Use {"type": "adaptive"} to let Claude decide when to think, {"type": "enabled", "budget_tokens": 2048} for a fixed thinking budget (at least 1024 and below max_tokens), or {"type": "disabled"}. Which types a model accepts depends on the model.
- `tool_choice` (`object`, optional): Controls how the model uses the supplied tools. Use {"type": "auto"} to let the model decide, {"type": "any"} to force some tool call, {"type": "tool", "name": "get_weather"} to force one tool, or {"type": "none"} to forbid tool calls.
- `tools` (`array`, optional): Client tool definitions the model may call. Each tool has a name, a description, and an input_schema that is a JSON Schema object. Example: [{"name": "get_weather", "description": "Get the weather for a city", "input_schema": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}].
- `top_k` (`integer`, optional): Only sample from the top K token options. Models released after Claude Opus 4.6 reject this parameter, so leave it empty for them.
- `top_p` (`number`, optional): Nucleus sampling cutoff from 0.0 to 1.0. Models released after Claude Opus 4.6 reject values below 0.99, so leave this empty for them.

Example input: `{"max_tokens":1024,"messages":[{"role":"user","content":"Hello, Claude"}],"model":"<model>"}`

### `anthropic_create_message_batch`

Create Message Batch · Write

Submit up to 100,000 message requests to run asynchronously as one batch at reduced cost.
Returns the batch object with id, processing_status, request_counts, created_at and expires_at; results arrive within 24 hours.
Use for large offline workloads. Poll with anthropic_get_message_batch, then read output with anthropic_get_message_batch_results. Use anthropic_create_message for a single immediate reply.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `requests` (`array`, required): List of batch requests, 1 to 100,000. Each has a unique custom_id and params holding the same fields as a create-message call. Example: [{"custom_id": "req-1", "params": {"model": "claude-haiku-5-5", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello, world"}]}}].

Example input: `{"requests":[]}`

### `anthropic_delete_file`

Delete File · Destructive

Permanently delete an uploaded file.
Returns the deleted file id and type file_deleted.
Use to remove a file you no longer need; messages that reference it will fail afterwards.

Read only: no. Destructive: yes. Idempotent (safe to retry): yes.

Inputs:

- `file_id` (`string`, required): Id of the file, starting with file_. Returned by anthropic_list_files.

Example input: `{"file_id":"<file_id>"}`

### `anthropic_delete_message_batch`

Delete Message Batch · Destructive

Permanently delete a finished message batch and its results.
Returns the deleted batch id and type message_batch_deleted.
Use only after the batch has ended; cancel an in-progress batch first with anthropic_cancel_message_batch.

Read only: no. Destructive: yes. Idempotent (safe to retry): yes.

Inputs:

- `message_batch_id` (`string`, required): Id of the message batch, starting with msgbatch_. Returned by anthropic_create_message_batch and anthropic_list_message_batches.

Example input: `{"message_batch_id":"<message_batch_id>"}`

## Related

Other AI connectors ([all 134](/agentkit/connectors/?category=ai)):

- [Chorus](/agentkit/connectors/chorus/): Scalekit connector, Username and password, 9 tools
- [Gong](/agentkit/connectors/gong/): Scalekit connector, OAuth, 69 tools
- [Jiminny](/agentkit/connectors/jiminny/): Scalekit connector, Access token, 27 tools


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
