Skip to content

feat: add Anthropic account auth and usage - #20

Merged
ygpark80 merged 1 commit into
mainfrom
feat/65-anthropic-auth-phase1
Aug 18, 2026
Merged

feat: add Anthropic account auth and usage#20
ygpark80 merged 1 commit into
mainfrom
feat/65-anthropic-auth-phase1

Conversation

@ygpark80

@ygpark80 ygpark80 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

User description

Refs circlesac/prism#65

Changes

  • add prism anthropic auth login, list, remove, and usage commands
  • add prism claude login as an Anthropic login alias
  • include Claude accounts in the combined prism usage table

Testing

  • go test -mod=vendor -race ./...
  • go vet -mod=vendor ./...
  • gofmt clean
  • local binary verified with personal Max and authorized Team seat usage

Notes

  • Native Anthropic inference routing is not included in this release.

CodeAnt-AI Description

Add Anthropic account login and Claude usage tracking

What Changed

  • Users can sign in to Anthropic through a browser with prism anthropic auth login or the prism claude login alias, then list, view, and remove saved accounts
  • Anthropic login securely completes the browser callback and reports clear errors for cancelled, invalid, or expired sign-ins
  • prism anthropic usage shows Claude account quotas, and combined prism usage now includes Claude alongside ChatGPT and OpenCode
  • Combined usage still displays available providers when another provider is unavailable
  • Claude inference continues using existing Prism providers; this release does not route requests directly to Anthropic

Impact

✅ Claude accounts can be added and managed
✅ Claude quotas visible in provider usage reports
✅ Partial usage results remain available during provider outages

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Aug 18, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR a5186b3 Aug 18, 2026 · 10:17 10:21

@codeant-ai

codeant-ai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e2517bee-45e0-44f8-ac28-ae1c76d0db30


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Aug 18, 2026
@ygpark80
ygpark80 merged commit 15205f4 into main Aug 18, 2026
1 check passed
@ygpark80
ygpark80 deleted the feat/65-anthropic-auth-phase1 branch August 18, 2026 10:18
Comment thread internal/cli/claude.go
Comment on lines +33 to +45
if len(args) > 0 && args[0] == "login" {
options, positionals, err := parseCommonOptions(args[1:])
if err != nil {
return err
}
if len(positionals) != 0 || options.name != "" || options.providerAccountID != "" || options.ownerID != "" {
return errors.New("usage: prism claude login [--profile <name>]")
}
client, err := prismClient(ctx, options)
if err != nil {
return err
}
return loginProvider(ctx, "anthropic", client, stdout)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The login branch parses --help into options.help but never handles it before resolving credentials and invoking loginProvider. As a result, prism claude login --help starts the Anthropic OAuth flow instead of displaying help, unlike the standard provider command path. Check options.help and print the login usage before calling prismClient. [incorrect condition logic]

Severity Level: Major ⚠️
- ⚠️ `prism claude login --help` launches Anthropic OAuth unexpectedly.
- ⚠️ Users cannot inspect alias-specific login usage safely.
- ⚠️ Existing provider help handling correctly avoids credential resolution.

Use CodeAnt Skill

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** internal/cli/claude.go
**Line:** 33:45
**Comment:**
	*Incorrect Condition Logic: The login branch parses `--help` into `options.help` but never handles it before resolving credentials and invoking `loginProvider`. As a result, `prism claude login --help` starts the Anthropic OAuth flow instead of displaying help, unlike the standard provider command path. Check `options.help` and print the login usage before calling `prismClient`.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +59 to +67
listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
return AuthorizationGrant{}, errors.New("could not start the Anthropic OAuth callback")
}
defer listener.Close()

port := listener.Addr().(*net.TCPAddr).Port
redirectURI := fmt.Sprintf("http://localhost:%d/callback", port)
expectedHost := fmt.Sprintf("localhost:%d", port)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The callback listener is bound exclusively to IPv4 127.0.0.1, but the registered redirect uses localhost. On systems where the browser resolves localhost to IPv6 (::1) without falling back to IPv4, the browser cannot reach this listener and every Anthropic login attempt waits until timeout. Bind to a loopback address compatible with the redirect or use an IPv4 redirect hostname consistently. [api mismatch]

Severity Level: Major ⚠️
- ❌ Anthropic browser login can wait five minutes and time out.
- ❌ No Anthropic credential is saved after timeout.
- ⚠️ Failure affects hosts with IPv6-only localhost resolution.

Use CodeAnt Skill

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** internal/anthropic/oauth.go
**Line:** 59:67
**Comment:**
	*Api Mismatch: The callback listener is bound exclusively to IPv4 `127.0.0.1`, but the registered redirect uses `localhost`. On systems where the browser resolves `localhost` to IPv6 (`::1`) without falling back to IPv4, the browser cannot reach this listener and every Anthropic login attempt waits until timeout. Bind to a loopback address compatible with the redirect or use an IPv4 redirect hostname consistently.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant