-
Notifications
You must be signed in to change notification settings - Fork 91
feat(anthropic): add dedicated Claude-compatible endpoint layer #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dwnmf
wants to merge
16
commits into
Soju06:main
Choose a base branch
from
dwnmf:chore/uncommitted-snapshot-20260222
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5c79393
chore(wip): snapshot uncommitted changes
dwnmf 702e41a
fix(anthropic-compat): resolve ruff and ty diagnostics
dwnmf 6c8e9b8
chore(format): apply ruff formatting
dwnmf 20abe11
fix(anthropic-compat): return anthropic envelope for /v1/messages val…
dwnmf 2860039
fix(anthropic-compat): stabilize claude shared cache key policy
dwnmf 6e1206e
Merge remote-tracking branch 'origin/main' into chore/uncommitted-sna…
Soju06 d95d6dd
fix(anthropic): correct stop_reason mapping and deduplicate cache ali…
Soju06 282b26d
feat(codex-review): add re-review loop with convergence termination
Soju06 ad1dba6
Merge remote-tracking branch 'origin/main' into chore/uncommitted-sna…
Soju06 d979aad
fix(anthropic): strip x-api-key header and validate model before remap
Soju06 5699cb4
fix(anthropic): normalize camelCase cache extras to canonical snake_case
Soju06 f518f27
fix(anthropic): skip normalized cache keys in passthrough merge
Soju06 162f63f
fix(anthropic): accept camelCase promptCacheRetention in extraction
Soju06 dce84f8
fix(anthropic): align transport layer with review requests
dwnmf 3451df6
feat(anthropic): map reasoning effort aliases in compat translator
dwnmf fd76945
feat(anthropic): add configurable default reasoning effort
dwnmf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ | |
| "content-length", | ||
| "host", | ||
| "forwarded", | ||
| "x-api-key", | ||
| "x-real-ip", | ||
| "true-client-ip", | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
app/db/alembic/versions/013_add_request_logs_codex_session_hashes.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| """add codex session/conversation hashes to request_logs | ||
|
|
||
| Revision ID: 013_add_request_logs_codex_session_hashes | ||
| Revises: 012_add_import_without_overwrite_and_drop_accounts_email_unique | ||
| Create Date: 2026-02-22 | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
| from sqlalchemy.engine import Connection | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "013_add_request_logs_codex_session_hashes" | ||
| down_revision = "012_add_import_without_overwrite_and_drop_accounts_email_unique" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def _columns(connection: Connection, table_name: str) -> set[str]: | ||
| inspector = sa.inspect(connection) | ||
| if not inspector.has_table(table_name): | ||
| return set() | ||
| return {str(column["name"]) for column in inspector.get_columns(table_name) if column.get("name") is not None} | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| bind = op.get_bind() | ||
| columns = _columns(bind, "request_logs") | ||
| if not columns: | ||
| return | ||
|
|
||
| with op.batch_alter_table("request_logs") as batch_op: | ||
| if "codex_session_hash" not in columns: | ||
| batch_op.add_column(sa.Column("codex_session_hash", sa.String(), nullable=True)) | ||
| if "codex_conversation_hash" not in columns: | ||
| batch_op.add_column(sa.Column("codex_conversation_hash", sa.String(), nullable=True)) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| bind = op.get_bind() | ||
| columns = _columns(bind, "request_logs") | ||
| if not columns: | ||
| return | ||
|
|
||
| with op.batch_alter_table("request_logs") as batch_op: | ||
| if "codex_conversation_hash" in columns: | ||
| batch_op.drop_column("codex_conversation_hash") | ||
| if "codex_session_hash" in columns: | ||
| batch_op.drop_column("codex_session_hash") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fallback format detection still treats every
/v1/*path as OpenAI, so requests like malformed JSON to/v1/messages(or/v1/messages/count_tokens) can bypassset_anthropic_error_formatand return the OpenAI error shape instead of Anthropic's{"type":"error",...}envelope. Because JSON/body parsing errors are raised before route dependencies run, Anthropic clients can receive an incompatible error contract on exactly the endpoints this change adds.Useful? React with 👍 / 👎.