CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-com-anthropic--anthropic-java

The Anthropic Java SDK provides convenient access to the Anthropic REST API from applications written in Java

Overview
Eval results
Files

platform-adapters.mddocs/

Platform Adapters

The Anthropic Java SDK provides platform adapter modules that enable you to use Claude models on AWS Bedrock and Google Vertex AI, in addition to the direct Anthropic API. Platform adapters handle authentication, request signing, and platform-specific configuration while maintaining the same familiar API interface.

Overview

Platform adapters implement the Backend interface to adapt the SDK's core functionality for different cloud platforms:

  • Direct API - Default backend for direct Anthropic API access
  • AWS Bedrock - Access Claude models through Amazon Bedrock
  • Google Vertex AI - Access Claude models through Google Cloud Vertex AI

All backends integrate seamlessly with the SDK's client builders, allowing you to switch platforms with minimal code changes.

AWS Bedrock Adapter

The AWS Bedrock adapter enables access to Claude models through Amazon Bedrock, AWS's managed service for foundation models.

Installation

The Bedrock adapter requires the anthropic-java-bedrock library dependency in addition to the core SDK.

Gradle

implementation("com.anthropic:anthropic-java-bedrock:2.11.0")

Maven

<dependency>
    <groupId>com.anthropic</groupId>
    <artifactId>anthropic-java-bedrock</artifactId>
    <version>2.11.0</version>
</dependency>

BedrockBackend Class

class BedrockBackend { .api }

Location: anthropic-java-bedrock/src/main/kotlin/com/anthropic/bedrock/backends/BedrockBackend.kt

Properties:

  • val awsCredentialsProvider: AwsCredentialsProvider? - AWS credentials provider for authentication
  • val apiKey: String? - API key for Bedrock API key authentication (alternative to credentials)
  • val region: Region - AWS region where Bedrock is accessed
  • val awsCredentials: AwsCredentials - Resolved AWS credentials used for request signing

Static Factory Methods:

@JvmStatic fun builder(): Builder { .api }

Creates a new builder for constructing a BedrockBackend.

@JvmStatic fun fromEnv(): BedrockBackend { .api }

Creates a BedrockBackend configured from environment variables and AWS default provider chains.

Authentication

The Bedrock adapter supports two authentication methods:

AWS Credentials

Standard AWS credentials using access keys and secret keys. Credentials can be provided through:

  • AWS default credentials provider chain
  • Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
  • AWS credentials file (~/.aws/credentials)
  • IAM roles for EC2 instances or ECS tasks
  • Custom AwsCredentialsProvider implementations

API Keys

Bedrock API keys provide an alternative authentication method. API keys can be:

  • Set via the AWS_BEARER_TOKEN_BEDROCK environment variable
  • Passed directly using BedrockBackend.Builder.apiKey()

API keys take precedence over credentials when both are available in the environment.

Configuration

Automatic Configuration

Use BedrockBackend.fromEnv() to automatically resolve credentials and region:

import com.anthropic.bedrock.backends.BedrockBackend;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.fromEnv())
        .build();

This automatically:

Manual Configuration

Configure credentials and region explicitly:

import com.anthropic.bedrock.backends.BedrockBackend;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.AwsCredentials;
import software.amazon.awssdk.regions.Region;

AwsCredentials awsCredentials = AwsBasicCredentials.create(
        System.getenv("AWS_ACCESS_KEY_ID"),
        System.getenv("AWS_SECRET_ACCESS_KEY"));

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.builder()
                .awsCredentials(awsCredentials)
                .region(Region.US_EAST_1)
                .build())
        .build();

Custom Credentials Provider

Use a custom AWS credentials provider with additional features:

import com.anthropic.bedrock.backends.BedrockBackend;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;

AwsCredentialsProvider awsCredentialsProvider =
        DefaultCredentialsProvider.builder()
                .asyncCredentialUpdateEnabled(true)
                .build();

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.builder()
                .fromEnv(awsCredentialsProvider)
                .build())
        .build();

API Key Configuration

Configure using an API key instead of AWS credentials:

import com.anthropic.bedrock.backends.BedrockBackend;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import software.amazon.awssdk.regions.Region;

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.builder()
                .apiKey(myApiKey)
                .region(Region.US_EAST_1)
                .build())
        .build();

BedrockBackend.Builder

class BedrockBackend.Builder { .api }

Builder Methods:

fun fromEnv(awsCredentialsProvider: AwsCredentialsProvider? = null): Builder { .api }

Load configuration from environment variables. If awsCredentialsProvider is provided, uses it for credentials; otherwise uses default provider chain. Region is resolved from AWS default region provider chain. API key is loaded from AWS_BEARER_TOKEN_BEDROCK if available.

fun awsCredentialsProvider(provider: AwsCredentialsProvider): Builder { .api }

Set the AWS credentials provider. Cannot be used with apiKey().

fun awsCredentials(credentials: AwsCredentials): Builder { .api }

Set AWS credentials directly. Cannot be used with apiKey() or awsCredentialsProvider().

fun apiKey(apiKey: String): Builder { .api }

Set the Bedrock API key for authentication. Cannot be used with awsCredentials() or awsCredentialsProvider().

fun region(region: Region): Builder { .api }

Set the AWS region. Required for both credential-based and API key-based authentication.

fun build(): BedrockBackend { .api }

Build the BedrockBackend instance. Throws if required configuration is missing or conflicting.

Environment Variables

  • AWS_ACCESS_KEY_ID - AWS access key ID (for credentials-based auth)
  • AWS_SECRET_ACCESS_KEY - AWS secret access key (for credentials-based auth)
  • AWS_SESSION_TOKEN - AWS session token (optional, for temporary credentials)
  • AWS_BEARER_TOKEN_BEDROCK - Bedrock API key (for API key-based auth)
  • AWS_REGION - AWS region (used by default region provider chain)
  • AWS_DEFAULT_REGION - Alternative AWS region variable

AWS Credentials Provider Chain

When using fromEnv() without a custom provider, credentials are resolved in this order:

  1. Java system properties (aws.accessKeyId, aws.secretAccessKey)
  2. Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
  3. Web identity token from AWS STS (for EKS/ECS)
  4. AWS credentials file (~/.aws/credentials)
  5. Amazon EC2 instance profile credentials (for EC2 instances)
  6. Container credentials (for ECS tasks)

See AWS documentation for complete details.

Usage Examples

Basic Usage with Automatic Configuration

import com.anthropic.bedrock.backends.BedrockBackend;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.messages.Message;
import com.anthropic.models.messages.MessageCreateParams;
import com.anthropic.models.messages.Model;

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.fromEnv())
        .build();

MessageCreateParams params = MessageCreateParams.builder()
        .maxTokens(1024L)
        .addUserMessage("Hello, Claude on Bedrock")
        .model(Model.CLAUDE_SONNET_4_20250514)
        .build();

Message message = client.messages().create(params);
System.out.println(message.content().get(0).asText().text());

Explicit Region and Credentials

import com.anthropic.bedrock.backends.BedrockBackend;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.regions.Region;

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.builder()
                .awsCredentials(AwsBasicCredentials.create(
                        "YOUR_ACCESS_KEY",
                        "YOUR_SECRET_KEY"))
                .region(Region.US_WEST_2)
                .build())
        .build();

Using API Keys

import com.anthropic.bedrock.backends.BedrockBackend;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import software.amazon.awssdk.regions.Region;

// From environment variable AWS_BEARER_TOKEN_BEDROCK
AnthropicClient client1 = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.fromEnv())
        .build();

// Explicit API key
AnthropicClient client2 = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.builder()
                .apiKey(System.getenv("BEDROCK_API_KEY"))
                .region(Region.US_EAST_1)
                .build())
        .build();

Custom Credentials Provider

import com.anthropic.bedrock.backends.BedrockBackend;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;

// Use specific AWS profile
AwsCredentialsProvider provider = ProfileCredentialsProvider.builder()
        .profileName("production")
        .build();

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.builder()
                .fromEnv(provider)
                .build())
        .build();

Limitations

The Bedrock backend currently does not support:

  • Batch API - Message batch operations are not available on Bedrock
  • Token Counting API - The messages().countTokens() method is not supported

All other API functionality (messages, streaming, tools, prompt caching) works identically to the direct Anthropic API.

Google Vertex AI Adapter

The Google Vertex AI adapter enables access to Claude models through Google Cloud Vertex AI, Google Cloud's platform for ML models.

Installation

The Vertex AI adapter requires the anthropic-java-vertex library dependency in addition to the core SDK.

Gradle

implementation("com.anthropic:anthropic-java-vertex:2.11.0")

Maven

<dependency>
    <groupId>com.anthropic</groupId>
    <artifactId>anthropic-java-vertex</artifactId>
    <version>2.11.0</version>
</dependency>

VertexBackend Class

class VertexBackend { .api }

Location: anthropic-java-vertex/src/main/kotlin/com/anthropic/vertex/backends/VertexBackend.kt

Properties:

  • val googleCredentials: GoogleCredentials - Google OAuth2 credentials for authentication
  • val region: String - Google Cloud region where Vertex AI is accessed
  • val project: String - Google Cloud project ID

Static Factory Methods:

@JvmStatic fun builder(): Builder { .api }

Creates a new builder for constructing a VertexBackend.

@JvmStatic fun fromEnv(): VertexBackend { .api }

Creates a VertexBackend configured from environment variables and Google Application Default Credentials.

Authentication

The Vertex AI adapter uses Google OAuth2 credentials for authentication.

Google Application Default Credentials (ADC)

The primary authentication method uses Application Default Credentials, which automatically discovers credentials in this order:

  1. GOOGLE_APPLICATION_CREDENTIALS environment variable pointing to a service account key file
  2. User credentials from gcloud auth application-default login
  3. Google Compute Engine service account (for GCE instances)
  4. Google Kubernetes Engine workload identity (for GKE pods)

Service Account Keys

For service accounts, credentials are loaded from a JSON key file:

{
  "type": "service_account",
  "project_id": "your-project-id",
  "private_key_id": "key-id",
  "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
  "client_email": "service-account@your-project.iam.gserviceaccount.com",
  "client_id": "123456789",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token"
}

Configuration

Automatic Configuration

Use VertexBackend.fromEnv() to automatically resolve credentials, region, and project:

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.vertex.backends.VertexBackend;

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(VertexBackend.fromEnv())
        .build();

This automatically:

  • Resolves credentials using Google Application Default Credentials
  • Loads region from CLOUD_ML_REGION environment variable
  • Loads project ID from ANTHROPIC_VERTEX_PROJECT_ID environment variable

Manual Configuration

Configure credentials, region, and project explicitly:

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.vertex.backends.VertexBackend;
import com.google.auth.oauth2.AccessToken;
import com.google.auth.oauth2.GoogleCredentials;

String accessToken = System.getenv("GOOGLE_ACCESS_TOKEN");
String project = System.getenv("ANTHROPIC_VERTEX_PROJECT_ID");

GoogleCredentials googleCredentials = GoogleCredentials.create(
        AccessToken.newBuilder().setTokenValue(accessToken).build());

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(VertexBackend.builder()
                .googleCredentials(googleCredentials)
                .region("us-central1")
                .project(project)
                .build())
        .build();

Service Account Configuration

Load credentials from a service account key file:

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.vertex.backends.VertexBackend;
import com.google.auth.oauth2.GoogleCredentials;
import java.io.FileInputStream;

GoogleCredentials credentials = GoogleCredentials.fromStream(
        new FileInputStream("/path/to/service-account-key.json"));

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(VertexBackend.builder()
                .googleCredentials(credentials)
                .region("us-central1")
                .project("my-project-id")
                .build())
        .build();

VertexBackend.Builder

class VertexBackend.Builder { .api }

Builder Methods:

fun fromEnv(): Builder { .api }

Load configuration from environment variables. Uses Google Application Default Credentials for authentication. Region is loaded from CLOUD_ML_REGION. Project ID is loaded from ANTHROPIC_VERTEX_PROJECT_ID.

fun googleCredentials(credentials: GoogleCredentials): Builder { .api }

Set the Google OAuth2 credentials for authentication.

fun region(region: String): Builder { .api }

Set the Google Cloud region (e.g., "us-central1", "europe-west1").

fun project(project: String): Builder { .api }

Set the Google Cloud project ID.

fun build(): VertexBackend { .api }

Build the VertexBackend instance. Throws if required configuration is missing.

Environment Variables

  • GOOGLE_APPLICATION_CREDENTIALS - Path to service account JSON key file (used by ADC)
  • CLOUD_ML_REGION - Google Cloud region for Vertex AI
  • ANTHROPIC_VERTEX_PROJECT_ID - Google Cloud project ID
  • GOOGLE_CLOUD_PROJECT - Alternative project ID variable (lower priority)

Usage Examples

Basic Usage with Automatic Configuration

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.messages.Message;
import com.anthropic.models.messages.MessageCreateParams;
import com.anthropic.models.messages.Model;
import com.anthropic.vertex.backends.VertexBackend;

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(VertexBackend.fromEnv())
        .build();

MessageCreateParams params = MessageCreateParams.builder()
        .maxTokens(1024L)
        .addUserMessage("Hello, Claude on Vertex AI")
        .model(Model.CLAUDE_SONNET_4_20250514)
        .build();

Message message = client.messages().create(params);
System.out.println(message.content().get(0).asText().text());

Explicit Configuration

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.vertex.backends.VertexBackend;
import com.google.auth.oauth2.GoogleCredentials;

GoogleCredentials credentials = GoogleCredentials.getApplicationDefault();

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(VertexBackend.builder()
                .googleCredentials(credentials)
                .region("us-east4")
                .project("my-gcp-project")
                .build())
        .build();

Using Service Account Key

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.vertex.backends.VertexBackend;
import com.google.auth.oauth2.ServiceAccountCredentials;
import java.io.FileInputStream;

ServiceAccountCredentials credentials = ServiceAccountCredentials.fromStream(
        new FileInputStream("/path/to/key.json"));

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(VertexBackend.builder()
                .googleCredentials(credentials)
                .region("us-central1")
                .project("my-project")
                .build())
        .build();

User Credentials from gcloud

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.vertex.backends.VertexBackend;

// Requires: gcloud auth application-default login
AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(VertexBackend.fromEnv())
        .build();

Limitations

The Vertex AI backend currently does not support:

  • Batch API - Message batch operations are not available on Vertex AI

Token counting is supported on Vertex AI (unlike Bedrock). All other API functionality works identically to the direct Anthropic API.

Backend Interface

Platform adapters implement a common Backend interface that can be used to create custom platform integrations.

interface Backend { .api }

Location: anthropic-java-core/src/main/kotlin/com/anthropic/core/Backend.kt

The Backend interface defines methods for:

  • Constructing platform-specific base URLs
  • Applying platform-specific authentication headers and signatures
  • Adapting requests and responses for platform requirements

Custom Backend Implementation

To create a custom backend for a different platform:

import com.anthropic.core.Backend;

class CustomBackend implements Backend {
    @Override
    public String baseUrl() {
        return "https://custom-platform.example.com";
    }

    // Implement other Backend methods for authentication, signing, etc.
}

AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(new CustomBackend())
        .build();

Client Integration

All backends integrate with the client using the .backend() builder method:

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;

// Direct API (default)
AnthropicClient directClient = AnthropicOkHttpClient.fromEnv();

// AWS Bedrock
AnthropicClient bedrockClient = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.fromEnv())
        .build();

// Google Vertex AI
AnthropicClient vertexClient = AnthropicOkHttpClient.builder()
        .backend(VertexBackend.fromEnv())
        .build();

Once configured, the client API is identical regardless of backend:

MessageCreateParams params = MessageCreateParams.builder()
        .maxTokens(1024L)
        .addUserMessage("Hello, Claude")
        .model(Model.CLAUDE_SONNET_4_20250514)
        .build();

Message message = client.messages().create(params);

Credential Resolution

Automatic Resolution

Using fromEnv() methods provides automatic credential resolution:

AWS Bedrock:

  • Credentials: AWS default credentials provider chain
  • Region: AWS default region provider chain
  • API Key: AWS_BEARER_TOKEN_BEDROCK environment variable

Google Vertex AI:

  • Credentials: Google Application Default Credentials
  • Region: CLOUD_ML_REGION environment variable
  • Project: ANTHROPIC_VERTEX_PROJECT_ID environment variable

Manual Resolution

For more control, resolve credentials independently and pass them to the builder:

AWS Bedrock:

AwsCredentialsProvider provider = ProfileCredentialsProvider.builder()
        .profileName("production")
        .build();

BedrockBackend backend = BedrockBackend.builder()
        .awsCredentialsProvider(provider)
        .region(Region.US_WEST_2)
        .build();

Google Vertex AI:

GoogleCredentials credentials = ServiceAccountCredentials.fromStream(
        new FileInputStream(keyPath));

VertexBackend backend = VertexBackend.builder()
        .googleCredentials(credentials)
        .region("us-central1")
        .project(projectId)
        .build();

Best Practices

Security

Never hardcode credentials:

// DON'T DO THIS
AwsCredentials creds = AwsBasicCredentials.create("AKIAIOSFODNN7EXAMPLE", "secret");

Use environment variables or credential providers:

// DO THIS
AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.fromEnv())
        .build();

Store service account keys securely:

  • Never commit service account keys to version control
  • Use secret management services (AWS Secrets Manager, Google Secret Manager)
  • Rotate credentials regularly
  • Use minimal IAM permissions

Credential Management

Reuse credentials providers:

// Create once, reuse for multiple backends
AwsCredentialsProvider provider = DefaultCredentialsProvider.builder()
        .asyncCredentialUpdateEnabled(true)
        .build();

BedrockBackend backend1 = BedrockBackend.builder()
        .fromEnv(provider)
        .build();

Enable credential caching:

// Google credentials with refreshed tokens
GoogleCredentials credentials = GoogleCredentials.getApplicationDefault()
        .createScoped("https://www.googleapis.com/auth/cloud-platform");

Error Handling

Handle authentication errors:

try {
    AnthropicClient client = AnthropicOkHttpClient.builder()
            .backend(BedrockBackend.fromEnv())
            .build();

    Message message = client.messages().create(params);
} catch (UnauthorizedException e) {
    // Handle invalid credentials
    System.err.println("Authentication failed: " + e.getMessage());
} catch (PermissionDeniedException e) {
    // Handle insufficient permissions
    System.err.println("Insufficient permissions: " + e.getMessage());
}

Handle region/project errors:

try {
    VertexBackend backend = VertexBackend.fromEnv();
} catch (IllegalStateException e) {
    // Handle missing CLOUD_ML_REGION or ANTHROPIC_VERTEX_PROJECT_ID
    System.err.println("Configuration error: " + e.getMessage());
}

Resource Management

Reuse client instances:

// Create once, reuse throughout application
AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(BedrockBackend.fromEnv())
        .build();

// Use for multiple requests
Message msg1 = client.messages().create(params1);
Message msg2 = client.messages().create(params2);

Close clients when done:

try (AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(VertexBackend.fromEnv())
        .build()) {

    Message message = client.messages().create(params);
}

Testing

Use dependency injection for backends:

public class MyService {
    private final AnthropicClient client;

    public MyService(Backend backend) {
        this.client = AnthropicOkHttpClient.builder()
                .backend(backend)
                .build();
    }
}

// Production
MyService prodService = new MyService(BedrockBackend.fromEnv());

// Testing
MyService testService = new MyService(new MockBackend());

Platform Selection

Choose the appropriate platform based on your needs:

Use Direct API when:

  • You need all features (batch API, token counting)
  • You're not already using AWS or Google Cloud
  • You want the latest features first

Use AWS Bedrock when:

  • Your infrastructure is on AWS
  • You need AWS IAM integration
  • You want unified billing with other AWS services
  • You need VPC endpoints for private networking

Use Google Vertex AI when:

  • Your infrastructure is on Google Cloud
  • You need Google Cloud IAM integration
  • You want unified billing with other GCP services
  • You need integration with other Vertex AI features

Configuration Management

Use configuration classes:

public class BackendConfig {
    public static Backend createBackend(String platform) {
        switch (platform.toLowerCase()) {
            case "bedrock":
                return BedrockBackend.fromEnv();
            case "vertex":
                return VertexBackend.fromEnv();
            case "direct":
            default:
                return null; // Uses default direct API
        }
    }
}

// Configure via environment variable
String platform = System.getenv("CLAUDE_PLATFORM");
AnthropicClient client = AnthropicOkHttpClient.builder()
        .backend(BackendConfig.createBackend(platform))
        .build();

For more information on client configuration and usage patterns, see Client Setup.

Install with Tessl CLI

npx tessl i tessl/maven-com-anthropic--anthropic-java@2.11.1

docs

client-setup.md

errors.md

index.md

messages.md

platform-adapters.md

streaming.md

structured-outputs.md

tools.md

tile.json