Skip to content
Docs

Anthropic Claude Enterprise

Production AI deployments typically require guarantees beyond what standard API tiers provide: higher rate limits for sustained throughput, priority routing during peak demand, extended context windows for processing large documents, and enterprise-grade data handling commitments. Anthropic Claude Enterprise provides these capabilities.

This guide covers configuring Beluga AI to use Claude Enterprise endpoints. The same anthropic provider handles both standard and enterprise configurations — enterprise features are enabled through configuration options, not a separate provider.

The Anthropic provider in Beluga AI supports both standard and enterprise Claude configurations through the same llm.ChatModel interface. Enterprise features are enabled through configuration options such as custom base URLs, extended context windows, and enterprise API keys.

Key enterprise capabilities:

  • Extended context windows (200K tokens for supported models)
  • Priority API routing and higher rate limits
  • Enhanced security and data handling guarantees
  • Dedicated enterprise API endpoints
  • Go 1.23 or later
  • A Beluga AI project initialized with go mod init
  • An Anthropic Enterprise API key
  • Enterprise account access with model permissions configured

Install the Anthropic provider:

Terminal window
go get github.com/lookatitude/beluga-ai/llm/providers/anthropic

Set your enterprise API key:

Terminal window
export ANTHROPIC_API_KEY="sk-ant-enterprise-..."

Create a ChatModel using the Anthropic provider with enterprise credentials:

package main
import (
"context"
"fmt"
"log"
"os"
"github.com/lookatitude/beluga-ai/config"
"github.com/lookatitude/beluga-ai/llm"
_ "github.com/lookatitude/beluga-ai/llm/providers/anthropic"
"github.com/lookatitude/beluga-ai/schema"
)
func main() {
ctx := context.Background()
// Create the Anthropic model via the registry.
model, err := llm.New("anthropic", config.ProviderConfig{
Model: "claude-sonnet-4-5-20250929",
APIKey: os.Getenv("ANTHROPIC_API_KEY"),
BaseURL: "https://api.anthropic.com", // Enterprise endpoint
})
if err != nil {
log.Fatalf("Failed to create model: %v", err)
}
// Build a conversation with a system prompt and user message.
msgs := []schema.Message{
schema.NewSystemMessage("You are an enterprise AI assistant."),
schema.NewHumanMessage("Analyze this enterprise data..."),
}
resp, err := model.Generate(ctx, msgs)
if err != nil {
log.Fatalf("Generate failed: %v", err)
}
fmt.Printf("Response: %s\n", resp.Text())
}

Use GenerateOption functional options to control model behavior per request:

// Use the extended 200K context window with a lower temperature.
resp, err := model.Generate(ctx, msgs,
llm.WithMaxTokens(4096),
llm.WithTemperature(0.3),
)
if err != nil {
log.Fatalf("Generate failed: %v", err)
}

If your enterprise account uses a dedicated API endpoint, configure it via BaseURL:

model, err := llm.New("anthropic", config.ProviderConfig{
Model: "claude-opus-4-20250514",
APIKey: os.Getenv("ANTHROPIC_API_KEY"),
BaseURL: "https://enterprise.api.anthropic.com",
Timeout: 60 * time.Second,
})

Enterprise accounts benefit from priority streaming. Use the Stream method for real-time output:

for chunk, err := range model.Stream(ctx, msgs) {
if err != nil {
log.Fatalf("Stream error: %v", err)
}
fmt.Print(chunk.Delta)
}
fmt.Println()

Bind tools to the enterprise model for function calling:

toolModel := model.BindTools([]schema.ToolDefinition{
{
Name: "lookup_customer",
Description: "Look up a customer record by ID.",
Parameters: map[string]any{
"type": "object",
"properties": map[string]any{
"customer_id": map[string]any{"type": "string"},
},
"required": []any{"customer_id"},
},
},
})
resp, err := toolModel.Generate(ctx, msgs)
if err != nil {
log.Fatalf("Generate failed: %v", err)
}

Wrap the enterprise model with Beluga’s resilience middleware for production use:

import "github.com/lookatitude/beluga-ai/resilience"
policy := resilience.RetryPolicy{
MaxAttempts: 5,
InitialBackoff: 500 * time.Millisecond,
MaxBackoff: 30 * time.Second,
BackoffFactor: 2.0,
Jitter: true,
}
// Use resilience.Do to wrap calls with retry logic.
var resp *schema.AIMessage
err := resilience.Do(ctx, policy, func(ctx context.Context) error {
var genErr error
resp, genErr = model.Generate(ctx, msgs)
return genErr
})
if err != nil {
log.Fatalf("Generate failed after retries: %v", err)
}

Integrate OpenTelemetry tracing to monitor enterprise API calls:

import (
"github.com/lookatitude/beluga-ai/llm"
"go.opentelemetry.io/otel"
)
tracer := otel.Tracer("beluga.llm.anthropic")
ctx, span := tracer.Start(ctx, "anthropic.generate")
defer span.End()
resp, err := model.Generate(ctx, msgs)
if err != nil {
span.RecordError(err)
log.Fatalf("Generate failed: %v", err)
}

Beluga’s o11y package provides built-in LLM middleware that automatically records gen_ai.* attributes on spans when configured.

Apply cross-cutting concerns using Beluga’s middleware pattern:

// Wrap with logging and fallback middleware.
model = llm.ApplyMiddleware(model,
llm.WithLogging(slog.Default()),
)
OptionDescriptionDefaultRequired
ModelClaude model ID (e.g., claude-sonnet-4-5-20250929)Yes
APIKeyAnthropic Enterprise API keyANTHROPIC_API_KEY env varYes
BaseURLAPI endpoint URLhttps://api.anthropic.comNo
TimeoutMaximum request duration30sNo

The Model field in config.ProviderConfig is empty. Specify a valid Claude model identifier.

The API key is invalid or does not have enterprise permissions. Verify that:

  1. The ANTHROPIC_API_KEY environment variable is set correctly.
  2. The key is an enterprise-tier key, not a standard API key.
  3. The key has not been revoked or expired.

Enterprise accounts have higher rate limits, but they can still be exceeded under heavy load. Use the resilience package retry policy shown above to handle transient rate limit responses.