Skip to content

docs: update CLAUDE.md and AGENTS.md with comprehensive codebase docu… - #3024

Closed
chenny2023 wants to merge 1 commit into
QuantumNous:mainfrom
chenny2023:claude/claude-md-mm2xedshjuo146xg-ujd5j
Closed

docs: update CLAUDE.md and AGENTS.md with comprehensive codebase docu…#3024
chenny2023 wants to merge 1 commit into
QuantumNous:mainfrom
chenny2023:claude/claude-md-mm2xedshjuo146xg-ujd5j

Conversation

@chenny2023

@chenny2023 chenny2023 commented Feb 26, 2026

Copy link
Copy Markdown

…mentation

Rewrote both files with current, accurate information including:

  • Full directory structure with all subdirectories and their purposes
  • Complete channel provider table (50+ providers) with type IDs
  • Relay channel.Adaptor interface specification
  • Task/async channel adapters (suno, kling, jimeng, vidu, doubao, sora, etc.)
  • Setting sub-packages (ratio_setting, model_setting, operation_setting, etc.)
  • Frontend stack details (React 18, Vite, Semi Design, Tailwind, VChart, etc.)
  • All 7 i18n locales (zh-CN, zh-TW, en, fr, ru, ja, vi)
  • Middleware inventory with purpose descriptions
  • common/ utilities inventory
  • Router structure (/api, /v1, /v1beta, /claude/v1, /video routes)
  • Development workflow (make, bun, docker multi-stage build)
  • Testing conventions and test file locations
  • Additional conventions (logging, config, channel affinity, payments)
  • Go module name and version (github.com/QuantumNous/new-api, Go 1.25.1)

https://claude.ai/code/session_01Ljf9pKPNPiGBq646zKBAzM

Summary by CodeRabbit

  • Documentation
    • Expanded provider support from 40+ to 50+
    • Updated Go version to 1.25.1
    • Enhanced frontend stack with Tailwind CSS integration
    • Improved architecture documentation with granular package and router descriptions
    • Comprehensive channel/provider coverage and additional API endpoint documentation

…mentation

Rewrote both files with current, accurate information including:
- Full directory structure with all subdirectories and their purposes
- Complete channel provider table (50+ providers) with type IDs
- Relay channel.Adaptor interface specification
- Task/async channel adapters (suno, kling, jimeng, vidu, doubao, sora, etc.)
- Setting sub-packages (ratio_setting, model_setting, operation_setting, etc.)
- Frontend stack details (React 18, Vite, Semi Design, Tailwind, VChart, etc.)
- All 7 i18n locales (zh-CN, zh-TW, en, fr, ru, ja, vi)
- Middleware inventory with purpose descriptions
- common/ utilities inventory
- Router structure (/api, /v1, /v1beta, /claude/v1, /video routes)
- Development workflow (make, bun, docker multi-stage build)
- Testing conventions and test file locations
- Additional conventions (logging, config, channel affinity, payments)
- Go module name and version (github.com/QuantumNous/new-api, Go 1.25.1)

https://claude.ai/code/session_01Ljf9pKPNPiGBq646zKBAzM
@coderabbitai

coderabbitai Bot commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The PR comprehensively updates documentation files (AGENTS.md and CLAUDE.md) to reflect expanded project scope, including provider count increase from 40+ to 50+, Go version bump to 1.25.1, and Tailwind CSS integration. It adds granular architectural descriptions for routers, controllers, services, middleware, common utilities, and relay/channel structures with explicit interface specifications and registry conventions.

Changes

Cohort / File(s) Summary
Documentation Expansion
AGENTS.md, CLAUDE.md
Comprehensive updates expanding provider coverage (40+ to 50+), Go version specs (1.22+ to 1.25.1), frontend stack (Tailwind CSS), architecture package structure with granular sub-packages, router endpoint coverage, channel adaptor interface specifications, relay adaptor registry usage, i18n tooling commands, common utilities and middleware catalog, documentation conventions for error handling and logging, and development workflow details.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • feat: deepseek claude endpoint #1832: Implements Claude routing and adaptor delegation in relay channel, directly applying the adaptor contract and registry patterns newly documented in this PR.
  • feat: minimax native /v1/messages #2960: Updates relay/channel adaptor for Claude with dispatch and adaptor delegation logic that aligns with the documented adaptor interface requirements and StreamOptions registration conventions.

Suggested reviewers

  • Calcium-Ion

Poem

🐰 Hop, hop, the docs now gleam so bright,
Fifty providers, carefully described just right,
Adaptors, routers, middleware galore,
Architecture mapped from floor to floor,
With Go 1.25 and Tailwind's embrace,
Our project docs found their perfect place!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: updating two documentation files (CLAUDE.md and AGENTS.md) with comprehensive codebase documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@AGENTS.md`:
- Around line 348-349: Standardize the spelling to "adapter" in Rule 4: change
"adaptor registry" to "adapter registry" and ensure the interface name/reference
is consistent (e.g., update occurrences of channel.Adaptor to channel.Adapter if
you choose "Adapter") as well as any mentions of streamSupportedChannels to
match that same spelling scheme; update all related text in Rule 4 so "adapter"
is used uniformly.
- Around line 24-59: The markdown has unlabeled fenced code blocks around the
architecture lists (the block containing "router/ — HTTP routing: SetApiRouter,
SetDashboardRouter, SetRelayRouter, SetVideoRouter, SetWebRouter" and the block
showing routes like "/api/* — SetApiRouter" and "/ — SetWebRouter"); update both
fences to include a language label (e.g., change ``` to ```text) so markdownlint
MD040 is satisfied, ensuring all code blocks in AGENTS.md (the ones containing
"router/", "electron/" and the route examples with
"SetApiRouter"/"SetWebRouter") are consistently labeled.

In `@CLAUDE.md`:
- Around line 24-59: The Markdown fenced code blocks in CLAUDE.md lack language
tags (triggering MD040); update each triple-backtick block (e.g., the directory
listing block and the route listing block) to include a language tag such as
"text" so they become ```text ... ```; locate the blocks shown in the diff (the
router/.../electron/... listing and the /api/* ... / ... routing listing) and
add the language tag to each opening fence to satisfy the linter.
- Around line 348-349: Replace the inconsistent spelling "adaptor" with
"adapter" in this section: change the phrase "relay adaptor registry" to "relay
adapter registry" and rename any references to channel.Adaptor to
channel.Adapter (and any textual mentions of "adaptor") so all occurrences
(including the two bullets referencing streamSupportedChannels and the
channel.Adaptor interface) use the single term "adapter" consistently.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 982dc5c and 9a953ef.

📒 Files selected for processing (2)
  • AGENTS.md
  • CLAUDE.md

Comment thread AGENTS.md
Comment on lines 24 to +59
```
router/ — HTTP routing (API, relay, dashboard, web)
controller/ — Request handlers
service/ — Business logic
model/ — Data models and DB access (GORM)
relay/ — AI API relay/proxy with provider adapters
relay/channel/ — Provider-specific adapters (openai/, claude/, gemini/, aws/, etc.)
middleware/ — Auth, rate limiting, CORS, logging, distribution
setting/ — Configuration management (ratio, model, operation, system, performance)
common/ — Shared utilities (JSON, crypto, Redis, env, rate-limit, etc.)
dto/ — Data transfer objects (request/response structs)
constant/ — Constants (API types, channel types, context keys)
types/ — Type definitions (relay formats, file sources, errors)
i18n/ — Backend internationalization (go-i18n, en/zh)
oauth/ — OAuth provider implementations
pkg/ — Internal packages (cachex, ionet)
web/ — React frontend
web/src/i18n/ — Frontend internationalization (i18next, zh/en/fr/ru/ja/vi)
router/ — HTTP routing: SetApiRouter, SetDashboardRouter, SetRelayRouter, SetVideoRouter, SetWebRouter
controller/ — Request handlers (50+ files covering all endpoints)
service/ — Business logic; sub-packages: openaicompat/, passkey/
model/ — Data models and DB access (GORM); covers users, channels, tokens, logs, tasks, etc.
relay/ — AI API relay/proxy core
relay/channel/ — Provider-specific adaptors (implements channel.Adaptor interface)
relay/channel/task/ — Async/video task channel adaptors (ali, doubao, gemini, hailuo, jimeng, kling, sora, suno, taskcommon, vertex, vidu)
relay/common/ — RelayInfo, billing helpers, relay utilities
relay/common_handler/ — Shared rerank handler
relay/helper/ — Price/model mapping, stream scanner
relay/constant/ — Relay mode constants
relay/reasonmap/ — Reasoning model mappings
middleware/ — Auth, rate limiting, CORS, logging, gzip, body cleanup, stats
setting/ — Configuration management sub-packages:
setting/ratio_setting/ — Model/group price ratios (cache, expose, compact)
setting/model_setting/ — Per-model settings (Claude, Gemini, Grok, Qwen)
setting/operation_setting/ — General, quota, token, payment, checkin, affinity, monitor, status codes
setting/performance_setting/ — Performance/concurrency config
setting/console_setting/ — Console-specific settings
setting/system_setting/ — Discord, OIDC, Passkey, legal, fetch settings
setting/config/ — Global config singleton
common/ — Shared utilities (see below)
dto/ — Data transfer objects (OpenAI, Claude, Gemini, Midjourney, audio, video, etc.)
constant/ — Channel types/IDs, API types, context keys, endpoints, env vars, task types
types/ — Type definitions: relay formats, file sources/data, errors (NewAPIError), price data
i18n/ — Backend internationalization (go-i18n v2, en/zh locale files)
oauth/ — OAuth provider implementations (registered via init())
logger/ — Structured logging
pkg/
pkg/cachex/ — Hybrid in-memory/Redis cache with namespacing (codec, hybrid_cache, namespace)
pkg/ionet/ — Container/hardware introspection for io.net deployment
web/ — React frontend (see Frontend section)
docs/ — Documentation: channel/, images/, installation/, openapi/, translation glossaries
electron/ — Electron desktop app wrapper
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Specify fenced-code languages here as well.

Line 24 and Line 142 use unlabeled fenced code blocks; this will fail markdownlint MD040.

📝 Proposed fix
-```
+```text
 router/          — HTTP routing: SetApiRouter, SetDashboardRouter, SetRelayRouter, SetVideoRouter, SetWebRouter
 ...
 electron/        — Electron desktop app wrapper

- +text
/api/* — SetApiRouter: user auth, OAuth, channel management, admin
...
/ — SetWebRouter: serves embedded React SPA

Also applies to: 142-149

🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 24-24: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` around lines 24 - 59, The markdown has unlabeled fenced code
blocks around the architecture lists (the block containing "router/ — HTTP
routing: SetApiRouter, SetDashboardRouter, SetRelayRouter, SetVideoRouter,
SetWebRouter" and the block showing routes like "/api/* — SetApiRouter" and "/ —
SetWebRouter"); update both fences to include a language label (e.g., change ```
to ```text) so markdownlint MD040 is satisfied, ensuring all code blocks in
AGENTS.md (the ones containing "router/", "electron/" and the route examples
with "SetApiRouter"/"SetWebRouter") are consistently labeled.

Comment thread AGENTS.md
Comment on lines +348 to +349
- If supported, add the channel to `streamSupportedChannels` in the relay adaptor registry.
- The `channel.Adaptor` interface must be fully implemented — all methods are required.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Keep adapter spelling consistent in Rule 4.

Line 348 uses “adaptor registry” while nearby text says “adapter”. Standardize one variant.

📝 Proposed fix
-- If supported, add the channel to `streamSupportedChannels` in the relay adaptor registry.
+- If supported, add the channel to `streamSupportedChannels` in the relay adapter registry.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- If supported, add the channel to `streamSupportedChannels` in the relay adaptor registry.
- The `channel.Adaptor` interface must be fully implemented — all methods are required.
- If supported, add the channel to `streamSupportedChannels` in the relay adapter registry.
- The `channel.Adaptor` interface must be fully implemented — all methods are required.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~348-~348: Do not mix variants of the same word (‘adaptor’ and ‘adapter’) within a single text.
Context: ... streamSupportedChannels in the relay adaptor registry. - The channel.Adaptor inter...

(EN_WORD_COHERENCY)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` around lines 348 - 349, Standardize the spelling to "adapter" in
Rule 4: change "adaptor registry" to "adapter registry" and ensure the interface
name/reference is consistent (e.g., update occurrences of channel.Adaptor to
channel.Adapter if you choose "Adapter") as well as any mentions of
streamSupportedChannels to match that same spelling scheme; update all related
text in Rule 4 so "adapter" is used uniformly.

Comment thread CLAUDE.md
Comment on lines 24 to +59
```
router/ — HTTP routing (API, relay, dashboard, web)
controller/ — Request handlers
service/ — Business logic
model/ — Data models and DB access (GORM)
relay/ — AI API relay/proxy with provider adapters
relay/channel/ — Provider-specific adapters (openai/, claude/, gemini/, aws/, etc.)
middleware/ — Auth, rate limiting, CORS, logging, distribution
setting/ — Configuration management (ratio, model, operation, system, performance)
common/ — Shared utilities (JSON, crypto, Redis, env, rate-limit, etc.)
dto/ — Data transfer objects (request/response structs)
constant/ — Constants (API types, channel types, context keys)
types/ — Type definitions (relay formats, file sources, errors)
i18n/ — Backend internationalization (go-i18n, en/zh)
oauth/ — OAuth provider implementations
pkg/ — Internal packages (cachex, ionet)
web/ — React frontend
web/src/i18n/ — Frontend internationalization (i18next, zh/en/fr/ru/ja/vi)
router/ — HTTP routing: SetApiRouter, SetDashboardRouter, SetRelayRouter, SetVideoRouter, SetWebRouter
controller/ — Request handlers (50+ files covering all endpoints)
service/ — Business logic; sub-packages: openaicompat/, passkey/
model/ — Data models and DB access (GORM); covers users, channels, tokens, logs, tasks, etc.
relay/ — AI API relay/proxy core
relay/channel/ — Provider-specific adaptors (implements channel.Adaptor interface)
relay/channel/task/ — Async/video task channel adaptors (ali, doubao, gemini, hailuo, jimeng, kling, sora, suno, taskcommon, vertex, vidu)
relay/common/ — RelayInfo, billing helpers, relay utilities
relay/common_handler/ — Shared rerank handler
relay/helper/ — Price/model mapping, stream scanner
relay/constant/ — Relay mode constants
relay/reasonmap/ — Reasoning model mappings
middleware/ — Auth, rate limiting, CORS, logging, gzip, body cleanup, stats
setting/ — Configuration management sub-packages:
setting/ratio_setting/ — Model/group price ratios (cache, expose, compact)
setting/model_setting/ — Per-model settings (Claude, Gemini, Grok, Qwen)
setting/operation_setting/ — General, quota, token, payment, checkin, affinity, monitor, status codes
setting/performance_setting/ — Performance/concurrency config
setting/console_setting/ — Console-specific settings
setting/system_setting/ — Discord, OIDC, Passkey, legal, fetch settings
setting/config/ — Global config singleton
common/ — Shared utilities (see below)
dto/ — Data transfer objects (OpenAI, Claude, Gemini, Midjourney, audio, video, etc.)
constant/ — Channel types/IDs, API types, context keys, endpoints, env vars, task types
types/ — Type definitions: relay formats, file sources/data, errors (NewAPIError), price data
i18n/ — Backend internationalization (go-i18n v2, en/zh locale files)
oauth/ — OAuth provider implementations (registered via init())
logger/ — Structured logging
pkg/
pkg/cachex/ — Hybrid in-memory/Redis cache with namespacing (codec, hybrid_cache, namespace)
pkg/ionet/ — Container/hardware introspection for io.net deployment
web/ — React frontend (see Frontend section)
docs/ — Documentation: channel/, images/, installation/, openapi/, translation glossaries
electron/ — Electron desktop app wrapper
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add fenced-code languages to keep docs lint-clean.

Line 24 and Line 142 open fenced blocks without a language tag, which triggers MD040.

📝 Proposed fix
-```
+```text
 router/          — HTTP routing: SetApiRouter, SetDashboardRouter, SetRelayRouter, SetVideoRouter, SetWebRouter
 ...
 electron/        — Electron desktop app wrapper

- +text
/api/* — SetApiRouter: user auth, OAuth, channel management, admin
...
/ — SetWebRouter: serves embedded React SPA

Also applies to: 142-149

🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 24-24: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` around lines 24 - 59, The Markdown fenced code blocks in CLAUDE.md
lack language tags (triggering MD040); update each triple-backtick block (e.g.,
the directory listing block and the route listing block) to include a language
tag such as "text" so they become ```text ... ```; locate the blocks shown in
the diff (the router/.../electron/... listing and the /api/* ... / ... routing
listing) and add the language tag to each opening fence to satisfy the linter.

Comment thread CLAUDE.md
Comment on lines +348 to +349
- If supported, add the channel to `streamSupportedChannels` in the relay adaptor registry.
- The `channel.Adaptor` interface must be fully implemented — all methods are required.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use one term consistently: “adapter” vs “adaptor”.

Line 348 says “relay adaptor registry” while adjacent text uses “adapter”. Please standardize on one spelling in this section.

📝 Proposed fix
-- If supported, add the channel to `streamSupportedChannels` in the relay adaptor registry.
+- If supported, add the channel to `streamSupportedChannels` in the relay adapter registry.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- If supported, add the channel to `streamSupportedChannels` in the relay adaptor registry.
- The `channel.Adaptor` interface must be fully implemented — all methods are required.
- If supported, add the channel to `streamSupportedChannels` in the relay adapter registry.
- The `channel.Adaptor` interface must be fully implemented — all methods are required.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~348-~348: Do not mix variants of the same word (‘adaptor’ and ‘adapter’) within a single text.
Context: ... streamSupportedChannels in the relay adaptor registry. - The channel.Adaptor inter...

(EN_WORD_COHERENCY)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` around lines 348 - 349, Replace the inconsistent spelling
"adaptor" with "adapter" in this section: change the phrase "relay adaptor
registry" to "relay adapter registry" and rename any references to
channel.Adaptor to channel.Adapter (and any textual mentions of "adaptor") so
all occurrences (including the two bullets referencing streamSupportedChannels
and the channel.Adaptor interface) use the single term "adapter" consistently.

@seefs001 seefs001 closed this Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants