mirror of
https://github.com/justlovemaki/AIClient-2-API.git
synced 2026-04-25 09:25:59 +03:00
[PR #174] [CLOSED] feat: Native Claude Endpoint Support & Enhanced Token Calculation #284
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/AIClient-2-API-justlovemaki#284
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/justlovemaki/AIClient-2-API/pull/174
Author: @tickernelz
Created: 1/6/2026
Status: ❌ Closed
Base:
main← Head:main📝 Commits (4)
a5d9d89feat: add token logging feature and enhance API request handlinged652b7fix: correct indentation for customNameDisplay in handleStreamRequest function6d6c01cfix: remove unnecessary whitespace and improve code readability in toGeminiRequest method8fc25a8fix: remove jsonrepair dependency and fix code formatting📊 Changes
8 files changed (+422 additions, -285 deletions)
View changed files
📝
src/api-manager.js(+8 -0)📝
src/claude/claude-kiro.js(+358 -257)📝
src/common.js(+8 -3)📝
src/converters/strategies/ClaudeConverter.js(+14 -12)📝
src/ui-manager.js(+2 -0)📝
static/app/config-manager.js(+3 -0)📝
static/app/i18n.js(+6 -0)📝
static/index.html(+23 -13)📄 Description
Summary
This update introduces full native support for Anthropic Claude API endpoints (
/messagesand/models), enhances token calculation accuracy for Claude Kiro, and implements a configurable token logging feature. These improvements strengthen Anthropic API compatibility and provide granular visibility into token consumption patterns.Main Features
1. Native Claude Endpoint Support
/messagesendpoint for full Anthropic API compatibility/modelsendpoint to retrieve model information/v1/messagesendpointImplementation Files:
src/api-manager.js(lines 34-36, 59-62): Routing configuration for native endpointssrc/common.js(lines 54, 329-354): AddedCLAUDE_MODEL_LISTendpoint handling logic2. Enhanced Token Calculation for Claude Kiro
Implementation Files:
src/claude/claude-kiro.js(lines 1638-1710): RefactoredestimateInputTokens()with breakdown logicsrc/claude/claude-kiro.js(lines 1421-1593): Enhanced token logging in streaming responses3. Configurable Token Logging
ENABLE_TOKEN_LOGGINGconfiguration flagImplementation Files:
src/claude/claude-kiro.js(lines 1165-1168, 1395-1397, 1549-1551, 1704-1706): Conditional logging implementationstatic/app/config-manager.js(lines 70, 84): UI configuration handlingstatic/app/i18n.js: Localization strings for settingsstatic/index.html: Settings panel UI element4. Model List Conversion Enhancement
Implementation Files:
src/common.js(lines 347-354): Conditional conversion logicsrc/converters/strategies/ClaudeConverter.js(lines 607-619, 624-637): Model list transformation strategies5. Code Quality Improvements
Technical Details
New API Endpoints
Token Calculation Methodology
Configuration Parameter
Testing Recommendations
Native Endpoint Validation:
/messagesendpoint compatibility with Anthropic SDK clients/modelsresponse structure against Anthropic specification/v1/messagesendpointToken Accounting Verification:
Conversion Compatibility:
Impact Analysis
Related Issues
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.