mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 16:56:16 +08:00
6a34253934
Adds a new managed OAuth provider that lets Claude Code route requests through a user's ChatGPT Plus/Pro subscription via the chatgpt.com backend-api/codex endpoint. - CodexOAuthManager: OpenAI Device Code flow with multi-account support, JWT-based account identification, and automatic access_token refresh. - Reuses the generic managed-auth command surface (auth_start_login, auth_poll_for_account, etc.) via provider dispatch in commands/auth.rs. - ClaudeAdapter detects codex_oauth providers, forces the base URL to the ChatGPT backend, pins api_format to openai_responses, and emits Authorization + originator headers; the forwarder injects the dynamic access_token and ChatGPT-Account-Id per request. - transform_responses gains an is_codex_oauth path that aligns the body with OpenAI's codex-rs ResponsesApiRequest contract: sets store:false, appends reasoning.encrypted_content to include, strips max_output_tokens / temperature / top_p, injects default instructions/tools/parallel_tool_calls, and forces stream:true. Covered by 9 new unit tests plus regression guards for the non-Codex path. - Stream check reuses the same transform flag so detection matches the production request shape. - Frontend adds CodexOAuthSection + useCodexOauth hook, integrates it into ClaudeFormFields / ProviderForm / AuthCenterPanel, ships a new "Codex (ChatGPT Plus/Pro)" preset, and adds zh/en/ja i18n strings.
22 lines
1.2 KiB
TypeScript
22 lines
1.2 KiB
TypeScript
export { useProviderCategory } from "./useProviderCategory";
|
|
export { useApiKeyState } from "./useApiKeyState";
|
|
export { useBaseUrlState } from "./useBaseUrlState";
|
|
export { useModelState } from "./useModelState";
|
|
export { useCodexConfigState } from "./useCodexConfigState";
|
|
export { useApiKeyLink } from "./useApiKeyLink";
|
|
export { useCustomEndpoints } from "./useCustomEndpoints";
|
|
export { useTemplateValues } from "./useTemplateValues";
|
|
export { useCommonConfigSnippet } from "./useCommonConfigSnippet";
|
|
export { useCodexCommonConfig } from "./useCodexCommonConfig";
|
|
export { useSpeedTestEndpoints } from "./useSpeedTestEndpoints";
|
|
export { useCodexTomlValidation } from "./useCodexTomlValidation";
|
|
export { useGeminiConfigState } from "./useGeminiConfigState";
|
|
export { useManagedAuth } from "./useManagedAuth";
|
|
export { useGeminiCommonConfig } from "./useGeminiCommonConfig";
|
|
export { useOmoModelSource } from "./useOmoModelSource";
|
|
export { useOpencodeFormState } from "./useOpencodeFormState";
|
|
export { useOmoDraftState } from "./useOmoDraftState";
|
|
export { useOpenclawFormState } from "./useOpenclawFormState";
|
|
export { useCopilotAuth } from "./useCopilotAuth";
|
|
export { useCodexOauth } from "./useCodexOauth";
|