Skip to main content

Connect to Anthropic

Anthropic provides advanced AI models for natural language processing, code generation, analysis, and reasoning tasks. You can create an Anthropic resource so you can build AI-powered apps and workflows that leverage Claude's capabilities for text generation, data analysis, content creation, and more.

What you can do with Anthropic in Retool

After you create an Anthropic resource in Retool, you can:

  • Generate, summarize, classify, and extract information from text using Claude's language models.
  • Build conversational, multi-turn chat experiences with context-aware responses.
  • Analyze images to generate captions, extract entities, or answer questions about visual content.
  • Choose between a Retool-managed key or your own Anthropic API key.

Supported models

Before you begin

Before creating an Anthropic resource, you need:

  • Retool permissions: Ability to create and manage resources in your Retool organization.
  • Anthropic API key (optional): An API key from your Anthropic Console account if you want to bring your own key. New Retool organizations automatically include an Anthropic resource with a Retool-managed key.

Create an Anthropic resource

Create a resource to connect Retool to Anthropic and configure authentication. Once connected, you can then select it when writing queries to make use of its available models.

Follow these steps to create an Anthropic resource in Retool.

Create a new resource

Navigate to Resources in the main navigation and click Create new > Resource and search for Anthropic. Then, click the Anthropic tile to create a new resource.

Configure connection settings

Specify a name for the resource that identifies it within your organization. Include a description that can provide more context to users and Assist about how to use the resource.

Configure authentication

Anthropic resources support two authentication options: Retool-managed keys or customer-provided keys (Bring Your Own Key).

Retool organizations include an Anthropic resource with a Retool-managed key by default. This allows you to use Claude models immediately without providing your own API key. Retool maintains a direct relationship with the AI provider and bills you directly for AI usage.

To use a Retool-managed key, set Key Source to Retool Managed.

Anthropic resource configuration with Retool-managed key
Anthropic resource configuration with Retool-managed key
Create separate API keys for Retool

Where possible, create dedicated API keys for Retool to best manage and revoke access without disruption. All API keys used with Retool are encrypted and stored securely.

Save the resource

Click Create resource to save your Anthropic resource. The resource is now available for use in apps and workflows.

Note

AI resources do not have a Test connection button. To verify your configuration, create a new app and ask the agent to test the resource for you.

Interact with Anthropic data

Once you've created an Anthropic resource, you can interact with Anthropic data using Retool.

Switch to the new app builder

Retool recommends using the new app builder so you can use natural language to build React-based apps using AI.

  • To use Anthropic models in the app builder, reference the resource in the prompt with @, such as @Anthropic. Refer to the data and functions documentation to learn more.
  • For classic apps, workflows, and agents, refer to the AI queries documentation to learn how to write a resource query.

Best practices

Follow these best practices to keep your Anthropic usage secure and cost-efficient.

Security

  • Rotate credentials regularly: Roll your Anthropic API key periodically from the Anthropic Console, and immediately if a key is ever exposed.
  • Create separate API keys for Retool: Use a dedicated Anthropic API key for Retool so you can revoke or rotate access without disrupting other integrations.
  • Use resource environments: Organizations on an Enterprise plan can configure multiple resource environments to maintain separate Anthropic API keys for production, staging, and development.

Manage token usage and cost

  • Choose the smallest capable model: Use a faster, cheaper model (e.g. Claude Haiku) for simple tasks like classification or extraction, and reserve larger models for tasks that need deeper reasoning.
  • Set output token limits: Configure a maximum output token limit appropriate to the task to avoid paying for unnecessarily long responses.
  • Trim conversation history: For chat use cases, truncate or summarize older messages instead of sending the full history on every request. Anthropic bills for all input tokens, including message history.
  • Monitor usage: Track token consumption and spend in the Anthropic Console to catch unexpected usage spikes early.