feat: add Anthropic Messages API support #18

Closed
opened 2026-05-01 23:51:14 +00:00 by rodin · 0 comments
Owner

Problem

review-bot only speaks OpenAI-compatible chat/completions API. The HAI proxy serves Claude models exclusively via the native Anthropic Messages API (/anthropic/v1/messages), not the OpenAI-compatible endpoint.

This means we cannot use Claude (Sonnet, Opus) for reviews — only GPT models work.

Proposed Solution

Add an --llm-provider flag (or auto-detect from base URL) that switches between:

  • openai (default): POST /chat/completions with OpenAI request format
  • anthropic: POST /messages with Anthropic request format (x-api-key header, anthropic-version header, different payload structure)

Acceptance Criteria

  • Can review PRs using Claude Sonnet via Anthropic Messages API
  • Existing OpenAI-compatible flow unchanged (backwards compatible)
  • Tests cover both providers
  • Composite action gains llm-provider input (defaults to openai)

Context

Discovered while integrating review-bot into gargoyle CI (PR grgl/gargoyle#507). Currently using GPT-4.1 + GPT-5 as the two reviewers, but we want Claude + GPT for model diversity.

## Problem review-bot only speaks OpenAI-compatible chat/completions API. The HAI proxy serves Claude models exclusively via the native Anthropic Messages API (`/anthropic/v1/messages`), not the OpenAI-compatible endpoint. This means we cannot use Claude (Sonnet, Opus) for reviews — only GPT models work. ## Proposed Solution Add an `--llm-provider` flag (or auto-detect from base URL) that switches between: - `openai` (default): `POST /chat/completions` with OpenAI request format - `anthropic`: `POST /messages` with Anthropic request format (`x-api-key` header, `anthropic-version` header, different payload structure) ## Acceptance Criteria - [ ] Can review PRs using Claude Sonnet via Anthropic Messages API - [ ] Existing OpenAI-compatible flow unchanged (backwards compatible) - [ ] Tests cover both providers - [ ] Composite action gains `llm-provider` input (defaults to `openai`) ## Context Discovered while integrating review-bot into gargoyle CI (PR grgl/gargoyle#507). Currently using GPT-4.1 + GPT-5 as the two reviewers, but we want Claude + GPT for model diversity.
rodin closed this issue 2026-05-02 01:57:49 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rodin/review-bot#18