> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/anthropic.md).

# Anthropic

Anthropic provides Claude AI models for natural language processing, function calling, and vision analysis.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector       | Authentication   |
| --------------- | ---------------- |
| Anthropic       | API key or token |
| Anthropic Admin | Admin API Key    |

#### Anthropic

Connect to Anthropic's Claude AI models for text generation, function calling, and vision analysis.

**Set up in Anthropic**

1. Go to the Anthropic Console at <https://console.anthropic.com> and sign in or create an account.
2. Add a payment method under Billing; API access is pay-as-you-go and keys cannot be created until billing is set up.
3. Open **Settings → API keys**, click **Create Key**, give it a name, and copy the key (it starts with `sk-ant-` and is shown only once).

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Anthropic**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field           | Required                 | What to enter                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ----------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| API Key                 | Yes                      | Your Anthropic API key from Anthropic Console. [Provider instructions](https://console.anthropic.com/settings/keys).                                                                                                                                                                                                                                                                                                                                                        |
| GitHub Token (Optional) | Optional / as applicable | GitHub Personal Access Token (classic `ghp_…` or fine-grained `github_pat_…`), required only if the Claude Code action will clone private repos. Scope to the workflow's needs: • Investigation only (clone + read): `Contents: Read` (+ `Metadata: Read` for fine-grained). • Claude Code opens PRs via `gh` CLI inside the sandbox: also add `Contents: Read and write` and `Pull requests: Read and write`. [Provider instructions](https://github.com/settings/tokens). |

**Provider documentation:** [Setup reference](https://console.anthropic.com/settings/keys).

#### Anthropic Admin

Read Anthropic organization cost, token usage and Claude Code metrics with an Admin API key. Separate from the standard Anthropic connection, which cannot access organization billing.

**Set up in Anthropic**

1. Prepare the Anthropic account or service that the workflow will access. Grant access to the required resources and operations.
2. **Admin API Key:** An Anthropic Admin API key, which starts with `sk-ant-admin`. Create one in the Console under Settings, Admin keys. This is NOT the same as a normal API key: a normal key cannot read organization cost or usage and is rejected here. An admin key can read spend across the whole organization, so treat it as a high-privilege secret.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Anthropic Admin**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field | Required | What to enter                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Admin API Key | Yes      | An Anthropic Admin API key, which starts with `sk-ant-admin`. Create one in the Console under Settings, Admin keys. This is NOT the same as a normal API key: a normal key cannot read organization cost or usage and is rejected here. An admin key can read spend across the whole organization, so treat it as a high-privilege secret. [Provider instructions](https://console.anthropic.com/settings/admin-keys). |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Anthropic** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Create Message

Create messages using Claude with support for text, function calling, and image analysis.

**Inputs**

| Field        | Type   | Required | Description                                                                                                                                                                                                                                                                                                                                                                              |
| ------------ | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Request Body | object | Yes      | Complete configuration for Claude message generation including model selection, conversation messages (text/images), optional tools for function calling, system instructions, generation parameters (temperature, tokens), streaming options, and metadata. This unified interface supports all Claude capabilities: text generation, vision analysis, and tool use in a single action. |

**Outputs**

| Field       | Type    | Description                  |
| ----------- | ------- | ---------------------------- |
| Status Code | integer | Status code of the response. |
| Headers     | dict    | Headers of the response.     |
| Body        | object  | Body of the response.        |

#### List Models

List available Anthropic Claude models for dynamic model selection.

**Inputs**

No input fields are required in this catalog entry.

**Outputs**

| Field       | Type    | Description                  |
| ----------- | ------- | ---------------------------- |
| Status Code | integer | Status code of the response. |
| Headers     | dict    | Headers of the response.     |
| Body        | object  | Body of the response.        |

#### Claude Code

Run Claude Code in an isolated sandbox.

**Inputs**

| Field                      | Type            | Required | Description                                                                                                                                                                                                                                                                                                                                                   |
| -------------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Prompt                     | string          | Yes      | The natural-language task for Claude Code to execute.                                                                                                                                                                                                                                                                                                         |
| Model                      | select (string) | No       | Anthropic model Claude Code uses inside the session. Available values: Default (Claude Code picks), Haiku (fast, cheap), Sonnet (balanced), Opus (deep reasoning). Default: .                                                                                                                                                                                 |
| Sandbox ID                 | string          | No       | Optional sandbox ID to reuse across calls.                                                                                                                                                                                                                                                                                                                    |
| Claude Code Session ID     | string          | No       | Optional Claude Code session ID to resume an in-progress conversation.                                                                                                                                                                                                                                                                                        |
| Max steps                  | integer         | No       | Hard cap on how many internal steps Claude Code can take. A step is one action by the agent — calling a tool, editing a file, running a shell command, or producing its final response. The initial prompt does not count. Raise only for genuinely long, multi-step tasks. Default: 25.                                                                      |
| Timeout (seconds)          | integer         | No       | Maximum time (in seconds) to wait for Claude Code to finish before killing the run. If exceeded, the run is terminated and returns whatever output exists so far. Default: 600.                                                                                                                                                                               |
| GitHub repos               | string\_array   | No       | Optional GitHub repos to clone into the sandbox before running.                                                                                                                                                                                                                                                                                               |
| Full clone                 | boolean         | No       | Clone the full git history instead of just the latest commit. Turn on when Claude Code needs to: read past commits with `git log`, find when a line changed with `git blame`, bisect a bug across commits, check out an older branch or tag, or compare versions of a file over time. Otherwise leave off — the shallow clone is much faster. Default: false. |
| Include intermediate steps | boolean         | No       | Return every step from Claude Code's agent loop — each tool call, file edit, and shell command — in turn\_events. Turn on for debugging or when a downstream node needs the full trace of what the agent did. Leave off when you only care about the final answer from Claude. Default: false.                                                                |

**Outputs**

| Field               | Type          | Description                                                               |
| ------------------- | ------------- | ------------------------------------------------------------------------- |
| Final Output        | textarea      | Claude Code's final assistant message.                                    |
| Session ID          | string        | Claude Code session ID for resuming this conversation.                    |
| Sandbox ID          | string        | The sandbox ID used for this run.                                         |
| Turn events         | object\_array | Redacted JSONL turn events from Claude Code.                              |
| New Files Created   | object\_array | Files created in /home/user/ during the Claude Code run.                  |
| Total Input Tokens  | integer       | Total prompt tokens for the run, including prompt-cache writes and reads. |
| Total Output Tokens | integer       | Total output tokens for the run.                                          |
| Stopped reason      | string        | Why the Claude Code run stopped.                                          |

#### Get Cost Report

Read what your Anthropic organization spent over a date range, optionally broken down by workspace or by model and token type.

**Inputs**

| Field         | Type            | Required | Description                                                                                                                                                                       |
| ------------- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Date Range    | select (string) | No       | Pick a preset window, or choose 'custom' and set Start Date and End Date. Anthropic buckets usage by UTC day. Options load from the selected connection. Default: last\_30\_days. |
| Start Date    | string          | No       | First UTC day to include (YYYY-MM-DD). Needed for 'custom'.                                                                                                                       |
| End Date      | string          | No       | Last UTC day to include (YYYY-MM-DD). This day is included. Needed for 'custom'.                                                                                                  |
| Group By      | select (string) | No       | Break the cost down by workspace, or by description to see per-model and per-token-type lines. Leave empty for daily totals only. Options load from the selected connection.      |
| Maximum Pages | integer         | No       | How many result pages to fetch before stopping (1-100). Minimum: 1. Maximum: 100.                                                                                                 |

**Outputs**

| Field      | Type    | Description                                            |
| ---------- | ------- | ------------------------------------------------------ |
| Total Cost | number  | Total spend over the whole date range, in dollars.     |
| Currency   | string  | Currency of the amounts, as reported by Anthropic.     |
| Buckets    | array   | One entry per day, with its total and its cost lines.  |
| Start Date | string  | Inclusive start of the range covered (RFC 3339).       |
| End Date   | string  | Exclusive end of the range covered (RFC 3339).         |
| Truncated  | boolean | True when more pages were available than were fetched. |

#### Get Messages Usage Report

Read Anthropic token usage over a date range, broken down by model, workspace, API key or service tier, with a cache hit rate.

**Inputs**

| Field          | Type            | Required | Description                                                                                                                                                                                                                                                                            |
| -------------- | --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Date Range     | select (string) | No       | Pick a preset window, or choose 'custom' and set Start Date and End Date. Anthropic buckets usage by UTC day. Options load from the selected connection. Default: last\_7\_days.                                                                                                       |
| Start Date     | string          | No       | First UTC day to include (YYYY-MM-DD). Needed for 'custom'.                                                                                                                                                                                                                            |
| End Date       | string          | No       | Last UTC day to include (YYYY-MM-DD). This day is included. Needed for 'custom'.                                                                                                                                                                                                       |
| Bucket Size    | select (string) | No       | Size of each time bucket. Narrower buckets return more buckets per request, and the API caps how many one response carries. Longer ranges are fetched a page at a time, so raise Max Pages if the result comes back truncated. Options load from the selected connection. Default: 1d. |
| Group By       | select (string) | No       | Break usage down by one or more of model, workspace, API key, account, service account, service tier, context window or inference geo. Options load from the selected connection.                                                                                                      |
| Workspace      | select (string) | No       | Limit the report to one workspace. Leave empty for the whole org. Options load from the selected connection.                                                                                                                                                                           |
| API Key        | select (string) | No       | Limit the report to usage from one API key. Options load from the selected connection.                                                                                                                                                                                                 |
| Accounts       | select (string) | No       | Limit the report to usage from specific organization members. Applies to console and OAuth traffic, which is the usage attributed to a person. Options load from the selected connection.                                                                                              |
| Models         | string          | No       | Limit the report to specific models. Comma-separated.                                                                                                                                                                                                                                  |
| Service Tiers  | select (string) | No       | Limit the report to specific service tiers, such as batch or standard. Options load from the selected connection.                                                                                                                                                                      |
| Context Window | select (string) | No       | Limit the report to a context window band. Long-context requests are priced differently, so this separates them. Options load from the selected connection.                                                                                                                            |
| Maximum Pages  | integer         | No       | How many result pages to fetch before stopping (1-100). Minimum: 1. Maximum: 100.                                                                                                                                                                                                      |

**Outputs**

| Field            | Type    | Description                                                                  |
| ---------------- | ------- | ---------------------------------------------------------------------------- |
| Totals           | object  | Token counts summed across the whole range.                                  |
| Buckets          | array   | One entry per time bucket, with its usage lines.                             |
| Cache Read Share | number  | Share of input tokens served from cache, as a percentage. Higher is cheaper. |
| Start Date       | string  | Inclusive start of the range covered (RFC 3339).                             |
| End Date         | string  | Exclusive end of the range covered (RFC 3339).                               |
| Truncated        | boolean | True when more pages were available than were fetched.                       |

#### Get Claude Code Usage Report

Read who used Claude Code on a given day, with sessions, lines of code, commits, pull requests and estimated cost per person.

**Inputs**

| Field         | Type            | Required | Description                                                                                                                                                                      |
| ------------- | --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Day           | select (string) | No       | Which single UTC day to report on. This endpoint covers one day per call, so only single-day options are offered. Options load from the selected connection. Default: yesterday. |
| Start Date    | string          | No       | First UTC day to include (YYYY-MM-DD). Needed for 'custom'.                                                                                                                      |
| Maximum Pages | integer         | No       | How many result pages to fetch before stopping (1-100). Minimum: 1. Maximum: 100.                                                                                                |

**Outputs**

| Field                | Type    | Description                                                        |
| -------------------- | ------- | ------------------------------------------------------------------ |
| Records              | array   | One record per actor, with their Claude Code activity for the day. |
| Total Estimated Cost | number  | Estimated Claude Code cost for the day, in dollars.                |
| Total Sessions       | number  | Claude Code sessions across every actor.                           |
| Active Actors        | number  | Distinct users or API keys that used Claude Code that day.         |
| Day                  | string  | The UTC day the report covers (YYYY-MM-DD).                        |
| Truncated            | boolean | True when more pages were available than were fetched.             |

#### Get Organization

Read which Anthropic organization the connected Admin key belongs to.

**Inputs**

No input fields are required in this catalog entry.

**Outputs**

| Field           | Type   | Description                                              |
| --------------- | ------ | -------------------------------------------------------- |
| Organization ID | string | Identifier of the organization the Admin key belongs to. |
| Name            | string | Display name of the organization.                        |

#### List Workspaces

List the workspaces in your Anthropic organization, with their names and IDs.

**Inputs**

| Field         | Type    | Required | Description                                                                         |
| ------------- | ------- | -------- | ----------------------------------------------------------------------------------- |
| Maximum Pages | integer | No       | How many result pages to fetch before stopping (1-100). Minimum: 1. Maximum: 100.   |
| After ID      | string  | No       | Continue a listing that was cut short. Paste the Next Cursor from the previous run. |

**Outputs**

| Field       | Type    | Description                                                 |
| ----------- | ------- | ----------------------------------------------------------- |
| Workspaces  | array   | Workspaces in the organization.                             |
| Total Count | number  | Number of entries returned.                                 |
| Truncated   | boolean | True when more results existed than the page limit fetched. |
| Next Cursor | string  | Cursor that continues a truncated listing.                  |

#### List Organization API Keys

List your Anthropic organization's API keys, with their status and workspace.

**Inputs**

| Field         | Type    | Required | Description                                                                         |
| ------------- | ------- | -------- | ----------------------------------------------------------------------------------- |
| Maximum Pages | integer | No       | How many result pages to fetch before stopping (1-100). Minimum: 1. Maximum: 100.   |
| After ID      | string  | No       | Continue a listing that was cut short. Paste the Next Cursor from the previous run. |

**Outputs**

| Field       | Type    | Description                                                 |
| ----------- | ------- | ----------------------------------------------------------- |
| API Keys    | array   | API keys in the organization.                               |
| Total Count | number  | Number of entries returned.                                 |
| Truncated   | boolean | True when more results existed than the page limit fetched. |
| Next Cursor | string  | Cursor that continues a truncated listing.                  |

#### List Organization Members

List the members of your Anthropic organization, with their roles.

**Inputs**

| Field         | Type    | Required | Description                                                                         |
| ------------- | ------- | -------- | ----------------------------------------------------------------------------------- |
| Maximum Pages | integer | No       | How many result pages to fetch before stopping (1-100). Minimum: 1. Maximum: 100.   |
| After ID      | string  | No       | Continue a listing that was cut short. Paste the Next Cursor from the previous run. |

**Outputs**

| Field       | Type    | Description                                                 |
| ----------- | ------- | ----------------------------------------------------------- |
| Users       | array   | Members of the organization.                                |
| Total Count | number  | Number of entries returned.                                 |
| Truncated   | boolean | True when more results existed than the page limit fetched. |
| Next Cursor | string  | Cursor that continues a truncated listing.                  |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/anthropic.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
