Files
CLIProxyAPI/internal/translator/init.go
Luis Pater c1031e2d3f **feat(translator): add Antigravity translation logic**
- Introduced request and response translation functions to enable compatibility between OpenAI Chat Completions API and Antigravity.
- Registered translation utilities for both streaming and non-streaming scenarios.
- Added support for reasoning content, tool calls, and metadata handling.
- Established request normalization and embedding for Antigravity-compatible payloads.
- Added new fields to `Params` struct for better tracking of finish reasons, usage metadata, and tool usage.
- Refactored handling of response transitions, final events, and state-driven logic in `ConvertAntigravityResponseToClaude`.
- Introduced `appendFinalEvents` and `resolveStopReason` helper functions for cleaner separation of concerns.
- Added `TotalTokenCount` field to `Params` struct for enhanced token tracking.
- Updated token count calculations to fallback on `TotalTokenCount` when specific counts are missing.
- Introduced `hasNonZeroUsageMetadata` function to validate presence of token data in `usage_metadata`.
2025-11-21 23:40:59 +08:00

37 lines
2.3 KiB
Go

package translator
import (
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/claude/gemini"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/claude/gemini-cli"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/claude/openai/chat-completions"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/claude/openai/responses"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/codex/claude"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/codex/gemini"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/codex/gemini-cli"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/codex/openai/chat-completions"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/codex/openai/responses"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/gemini-cli/claude"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/gemini-cli/gemini"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/gemini-cli/openai/chat-completions"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/gemini-cli/openai/responses"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/gemini/claude"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/gemini/gemini"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/gemini/gemini-cli"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/gemini/openai/chat-completions"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/gemini/openai/responses"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/openai/claude"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/openai/gemini"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/openai/gemini-cli"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/openai/openai/chat-completions"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/openai/openai/responses"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/antigravity/claude"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/antigravity/gemini"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/antigravity/openai/chat-completions"
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator/antigravity/openai/responses"
)