Search overlay panel for performing site-wide searches
Salesforce (Heroku) Named a Leader. Learn More!

Heroku AI: Claude 4 Sonnet is now available

Anthropic’s Claude 4 Sonnet, part of the next generation of Claude models, is now available on Heroku Managed Inference and Agents. This gives developers immediate access to a model designed for coding, advanced reasoning, and the support of capable AI agents. Heroku Managed Inference and Agents expands your AI choices, offering the freedom to build transformative applications with the developer and operational ease Heroku is known for. Claude 4 Sonnet extends what’s possible with AI systems by improving task planning, tool use, and overall agent experience within the Heroku ecosystem.

Claude 4 Sonnet offers a significant leap in performance, balancing cutting-edge intelligence with impressive speed and cost-efficiency. It’s designed to excel at a wide range of tasks, making it a versatile tool for developers looking to integrate advanced AI capabilities into their Heroku applications.

Terminal window showing commands and output for creating a Heroku AI model instance named "mia-chat-test" using claude-4-sonnet, with a resource name and setup instructions displayed.

Building with Claude 4 Sonnet made simple

Integrating Claude 4 Sonnet into your Heroku applications is streamlined through Heroku Managed Inference and Agents:

  • Seamless Integration: Easily attach Claude 4 Sonnet as a resource to your Heroku app. Environment variables are automatically configured, enabling straightforward API calls from your application code.
  • Build Powerful AI Agents: Combine Claude 4 Sonnet’s intelligence with Heroku’s agentic capabilities. Utilize the Model Context Protocol (MCP) to connect your LLM-powered agents to your existing tools, databases (like pgvector for Heroku Postgres for RAG), and other services within Heroku’s trusted environment.
  • Unified API Access: Heroku Managed Inference and Agents provides a consistent API experience, making it easier to experiment with and switch between different models as your requirements evolve.

Getting started with Claude 4 Sonnet on Heroku

You can start leveraging Claude 4 Sonnet in your Heroku applications today.

  1. Provision the Model: Attach the Claude 4 Sonnet model to your application using the Heroku CLI.
    heroku ai:models:create -a YOUR_APP_NAME claude-4-sonnet
  2. Utilize API Endpoints: Once provisioned, your application will have the necessary configuration variables to make API calls to the /v1/chat/completions endpoint (or the relevant agent endpoint like /v1/agents/heroku) to interact with Claude 4 Sonnet.You can invoke the model using various methods, including curl, or libraries available for Python, Ruby, and JavaScript, as detailed in the Heroku Dev Center documentation for Managed Inference and AgentsExample curl request:
    export INFERENCE_MODEL_ID=$(heroku config:get -a $APP_NAME INFERENCE_MODEL_ID) 
    # Ensure this is the Claude 4 Sonnet ID
    export INFERENCE_KEY=$(heroku config:get -a $APP_NAME INFERENCE_KEY)
    export INFERENCE_URL=$(heroku config:get -a $APP_NAME INFERENCE_URL)
    
    curl $INFERENCE_URL/v1/chat/completions \
      -H "Authorization: Bearer $INFERENCE_KEY" \
      -H "Content-Type: application/json" \
      -d '{
            "model": "'"$INFERENCE_MODEL_ID"'",
            "messages": [
              {"role": "user", "content": "Explain the benefits of using PaaS for AI applications."}
            ]
          }'

The future of AI Development on Heroku

The addition of Claude 4 Sonnet to Heroku Managed Inference and Agents represents our ongoing commitment to providing developers with powerful, accessible AI tools. We are excited to see the innovative applications and intelligent solutions you will build.

For detailed documentation, model IDs, and further examples, please visit the Heroku Dev Center.

Start building with Claude 4 Sonnet on Heroku today and redefine what’s possible with AI!

Browse the archives for News or all blogs. Subscribe to the RSS feed for News or all blogs.