You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Anil K Patel (Jira)" <ji...@apache.org> on 2026/06/03 12:51:00 UTC
[jira] [Assigned] (OFBIZ-13431) AI Plugin: Native Anthropic (Claude) adapter for direct API access
[ https://issues.apache.org/jira/browse/OFBIZ-13431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Anil K Patel reassigned OFBIZ-13431:
------------------------------------
Assignee: Anil K Patel
> AI Plugin: Native Anthropic (Claude) adapter for direct API access
> ------------------------------------------------------------------
>
> Key: OFBIZ-13431
> URL: https://issues.apache.org/jira/browse/OFBIZ-13431
> Project: OFBiz
> Issue Type: Sub-task
> Reporter: Anil K Patel
> Assignee: Anil K Patel
> Priority: Major
>
> h2. Summary
> Add a native Anthropic adapter so the AI plugin can call Anthropic's Messages API directly. Claude models (claude-opus-4-5, claude-sonnet-4-5, claude-3-5-haiku) already work today via an OpenAI-compatible proxy — this ticket adds a proper direct-API path for deployments that prefer not to route through a third party.
> h2. Background — using Claude today (no code required)
> The plugin's {{AiHttpClient}} uses OpenAI's chat/completions wire format. Most major LLM providers have adopted this format, so configuring a different provider is usually just a matter of changing the {{baseUrl}} in {{ai.properties}}.
> Claude is accessible today via OpenRouter — an aggregator that accepts the OpenAI format and translates to Anthropic on your behalf:
> {code}
> ai.provider.claude-via-openrouter.baseUrl=https://openrouter.ai/api/v1
> ai.provider.claude-via-openrouter.apiKey=YOUR_OPENROUTER_KEY
> ai.provider.claude-via-openrouter.model=anthropic/claude-sonnet-4-5
> {code}
> Point any agent at {{claude-via-openrouter}} and it works with no code changes. This is the recommended path for anyone who wants to try Claude immediately.
> h2. Why a native adapter is also needed
> Anthropic's direct API ({{https://api.anthropic.com/v1/messages}}) uses a different wire format from OpenAI's. Pointing the plugin at Anthropic directly with {{type=openai}} sends a request that Anthropic cannot understand.
> The differences are significant:
> - Endpoint path: {{/v1/messages}} not {{/chat/completions}}
> - System prompt: a separate top-level field, not a message in the array
> - Tool definitions, tool calls, and tool results all use different JSON shapes
> - Response structure (stop reason, content array, token counts) is different
> - {{max_tokens}} is required in every request
> Organisations that want to use their Anthropic API key directly — without routing through a third-party proxy — need a native adapter.
> h2. Design
> A {{type}} field is added to each provider block in {{ai.properties}} (default: {{openai}}; omitting it is backward compatible):
> {code}
> ai.provider.anthropic-default.baseUrl=https://api.anthropic.com/v1
> ai.provider.anthropic-default.apiKey=YOUR_ANTHROPIC_KEY
> ai.provider.anthropic-default.model=claude-sonnet-4-5
> ai.provider.anthropic-default.type=anthropic
> {code}
> A new {{AnthropicChatClient}} class implements the existing {{AiChatClient}} interface. {{AgentRunner}} selects the correct client at runtime based on provider type. The interface, {{AiHttpClient}}, and {{MockAiChatClient}} are all unchanged. All existing configurations continue to work without modification.
> h2. Acceptance criteria
> - {{ai.properties}} comments document the OpenRouter path for immediate Claude access
> - {{ai.provider.<name>.type=anthropic}} routes requests to the native Anthropic adapter
> - {{agentRun}} with an Anthropic provider completes a text-only turn correctly
> - {{agentRun}} with an Anthropic provider dispatches a tool call and feeds the result back correctly
> - All existing {{AgentRunnerTest}} unit tests pass unchanged
> - {{./gradlew classes}} and {{./gradlew checkstyleMain}} pass
> h2. Development branch
> [patelanil/ofbiz-plugins — feature/ai-plugin|https://github.com/patelanil/ofbiz-plugins/tree/feature/ai-plugin]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)