omni-anthropic

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: MIT

README

OmniLLM Provider for Anthropic

Go CI Go Lint Go SAST Docs Visualization License

Thick provider for OmniLLM using the official anthropic-sdk-go SDK.

Installation

go get github.com/plexusone/omnillm-anthropic

Quick Start

import (
    omnillm "github.com/plexusone/omnillm-core"
    _ "github.com/plexusone/omnillm-anthropic" // Auto-registers thick provider
)

client, _ := omnillm.NewClient(omnillm.ClientConfig{
    Provider: omnillm.ProviderNameAnthropic,
    APIKey:   os.Getenv("ANTHROPIC_API_KEY"),
})

Feature Support

Feature Supported
Chat Completion Yes
Streaming Yes
Tool Calling Yes
System Messages Yes
Extended Thinking Yes
JSON Mode No

Extended Thinking

Anthropic Claude models support extended thinking for complex reasoning tasks:

import omnillm "github.com/plexusone/omnillm-core"

// Using Anthropic-style Thinking config (native)
budget := int64(8192)
response, err := client.CreateChatCompletion(ctx, &omnillm.ChatCompletionRequest{
    Model: "claude-sonnet-4-20250514",
    Thinking: &omnillm.ThinkingConfig{
        Type:         omnillm.ThinkingTypeEnabled,
        BudgetTokens: &budget,
    },
    Messages: messages,
})

// Or use ReasoningEffort for cross-provider compatibility
effort := omnillm.ReasoningEffortHigh
response, err := client.CreateChatCompletion(ctx, &omnillm.ChatCompletionRequest{
    Model:           "claude-sonnet-4-20250514",
    ReasoningEffort: &effort,
    Messages:        messages,
})
ThinkingType Values
Value Description
omnillm.ThinkingTypeEnabled Enable thinking with explicit budget
omnillm.ThinkingTypeDisabled Disable thinking
omnillm.ThinkingTypeAdaptive Let the model decide
ReasoningEffort Mapping
ReasoningEffort Anthropic Behavior
"none" Thinking disabled
"low", "medium" Adaptive thinking
"high" Enabled with budget from MaxTokens

See Reasoning Feature Guide for details.

Configuration

Field Required Description
APIKey Yes Anthropic API key
BaseURL No Custom endpoint

Documentation

See OmniLLM Core for full API documentation.

License

MIT

Directories

Path Synopsis
Package anthropic provides an OmniLLM adapter for Anthropic's Claude API using the official anthropic-sdk-go.
Package anthropic provides an OmniLLM adapter for Anthropic's Claude API using the official anthropic-sdk-go.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL