Spaces:
Running
Running
Download src/free_claude_code/api/generation_paths.py from dherain24/claude-proxy: direct link, hf CLI and curl.
- Browser
- Download file 835 Bytes
-
https://huggingface.co/spaces/dherain24/claude-proxy/resolve/main/src/free_claude_code/api/generation_paths.py
- Command line
-
hf download hf://spaces/dherain24/claude-proxy/src/free_claude_code/api/generation_paths.py
-
curl -L -o generation_paths.py https://huggingface.co/spaces/dherain24/claude-proxy/resolve/main/src/free_claude_code/api/generation_paths.py
835 Bytes
| from __future__ import annotations | |
| """Public generation route classification shared by HTTP boundaries.""" | |
| from typing import Literal | |
| type WireApi = Literal["messages", "responses", "gemini", "chat"] | |
| _GEMINI_ACTIONS = (":generateContent", ":streamGenerateContent") | |
| def generation_api(path: str) -> WireApi | None: | |
| if path == "/v1/messages": | |
| return "messages" | |
| if path == "/v1/responses": | |
| return "responses" | |
| if path == "/v1/chat/completions": | |
| return "chat" | |
| if path.startswith("/v1beta/models/"): | |
| return "gemini" | |
| # Gemini SDKs with a custom base URL call /v1/models/... too. OpenAI clients | |
| # share that prefix, so only Gemini generation methods are Gemini there. | |
| if path.startswith("/v1/models/") and path.endswith(_GEMINI_ACTIONS): | |
| return "gemini" | |
| return None | |