Refactor models and logging for nexus-claude-api

- Update default models in config to use `claude-opus-4.6`.
- Introduce logging configuration to write logs to a file.
- Add correlation ID to error responses for better traceability.
- Implement diagnostics for summarizing message requests.
- Normalize legacy system messages in the API.
- Enhance tests to cover new logging and error handling features.
- Update README and documentation to reflect changes in model defaults and logging behavior.
This commit is contained in:
2026-06-26 22:36:09 +08:00
parent 2851fa01cf
commit 0e98ce57d4
21 changed files with 573 additions and 78 deletions

View File

@@ -42,16 +42,14 @@ The first version will not include:
The local API exposes:
- `claude-sonnet-4.6`
- `claude-opus-4.6`
- `claude-haiku-4.5`
Defaults:
- Main model: `claude-sonnet-4.6`
- Small model: `claude-haiku-4.5`
- Main model: `claude-opus-4.6`
- Small model: `claude-opus-4.6`
`claude-sonnet-4.6` is the default because the AI Nexus documentation recommends it as the cost-effective default for most use cases.
The proxy defaults to Opus because this deployment is intended for users whose Nexus access is limited to `claude-opus-4.6`. Sonnet and Haiku aliases are accepted for compatibility and resolved to Opus before calling Nexus.
## User Stories

View File

@@ -60,8 +60,8 @@ Options:
- `--port`, `-p`: default `4141`
- `--endpoint-url`: default `https://genai-nexus.api.corpinter.net`
- `--api-key`: optional; fallback to ignored local config, `NEXUS_API_KEY`, then `AWS_BEARER_TOKEN_BEDROCK`
- `--model`: default `claude-sonnet-4.6`
- `--small-model`: default `claude-haiku-4.5`
- `--model`: default `claude-opus-4.6`
- `--small-model`: default `claude-opus-4.6`
- `--claude-code`: print Claude Code launch command
- `--verbose`, `-v`: debug logging without secrets
@@ -95,15 +95,15 @@ Inbound authentication headers are accepted for compatibility but not validated
Public local model IDs:
- `claude-sonnet-4.6`
- `claude-opus-4.6`
- `claude-haiku-4.5`
Backend IDs are resolved through a mapping table. The initial default mapping keeps the same IDs, except common short aliases are supported:
Backend IDs are resolved through a mapping table. This deployment exposes Opus and maps common Sonnet/Haiku aliases to Opus for users whose Nexus access is limited to `claude-opus-4.6`:
- `claude-sonnet-4` -> `claude-sonnet-4.6`
- `claude-sonnet-4.6` -> `claude-opus-4.6`
- `claude-haiku-4.5` -> `claude-opus-4.6`
- `claude-sonnet-4` -> `claude-opus-4.6`
- `claude-opus-4` -> `claude-opus-4.6`
- `claude-haiku-4` -> `claude-haiku-4.5`
- `claude-haiku-4` -> `claude-opus-4.6`
If Nexus requires different backend IDs, update the mapping without changing Claude Code-facing model IDs.