mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-26 22:30:11 +00:00
* feat(decisions): serve System One format at /v1/systemone and OpenAI format at /v1/decisions The System One request format moves to /v1/systemone and /systemone. /v1/decisions and /decisions now accept the OpenAI Decisions API format, translate it into a System One request, route it through the same pipeline, and translate the answers back. * fix(decisions): import assert_never from typing_extensions for Python 3.10 * fix(decisions): cap OpenAI-format questions at the System One limit /v1/decisions accepted up to 200 questions, but the System One request it translates to takes at most 128, so 129 to 200 questions failed with an internal validation error. Both now share MAX_DECISION_QUESTIONS. * fix(decisions): return 400 for bodies that are not JSON * test(decisions): send System One bodies to /v1/systemone in integration tests * fix(decisions): return guardrail_information on OpenAI-format decisions when requested * refactor(decisions): validate proxy request data before reading guardrail settings
148 lines
3.3 KiB
Python
148 lines
3.3 KiB
Python
"""Path allowlist for the gateway component.
|
|
|
|
The gateway exposes the LLM data-plane surface: chat/completions, embeddings,
|
|
audio, batches, files, fine-tuning, rerank, decisions, ocr, rag, video, search, image,
|
|
responses, vector stores, passthrough providers, realtime websockets, MCP
|
|
tool-call endpoints, and operational endpoints (/health, /metrics, and the
|
|
/debug/memory/summary read of the serving worker's RSS).
|
|
|
|
Any path not listed here is dropped from the gateway process so management/UI
|
|
endpoints don't ride on the same pods.
|
|
|
|
Versioned data-plane paths are enumerated explicitly rather than allowing a
|
|
blanket `/v1/` or `/v2/` prefix — those broad prefixes would otherwise also
|
|
match management routes like `/v1/access_group`, `/v1/tool/{tool_name}/logs`,
|
|
`/v2/key/info`, etc.
|
|
"""
|
|
|
|
GATEWAY_PATH_PREFIXES: tuple[str, ...] = (
|
|
# OpenAI-compatible data-plane surface (versioned + unversioned)
|
|
"/v1/chat/",
|
|
"/chat/",
|
|
"/v1/completions",
|
|
"/completions",
|
|
"/v1/embeddings",
|
|
"/embeddings",
|
|
"/v1/moderations",
|
|
"/moderations",
|
|
"/v1/audio/",
|
|
"/audio/",
|
|
"/v1/images/",
|
|
"/images/",
|
|
"/v1/files",
|
|
"/files",
|
|
"/v1/batches",
|
|
"/batches",
|
|
"/v1/fine_tuning/",
|
|
"/fine_tuning/",
|
|
"/v1/fine-tuning/",
|
|
"/fine-tuning/",
|
|
"/v1/responses",
|
|
"/responses",
|
|
"/v1/threads",
|
|
"/threads",
|
|
"/v1/assistants",
|
|
"/assistants",
|
|
"/v1/vector_stores",
|
|
"/vector_stores",
|
|
"/v1/indexes",
|
|
"/v1/models",
|
|
"/models",
|
|
"/openai/",
|
|
"/engines/",
|
|
# Anthropic / agentic data-plane surface
|
|
"/v1/messages",
|
|
"/messages",
|
|
"/v1/skills",
|
|
"/v1/a2a/",
|
|
"/a2a/",
|
|
# LiteLLM-native LLM surface
|
|
"/v1/rerank",
|
|
"/v2/rerank",
|
|
"/rerank",
|
|
"/v1/decisions",
|
|
"/decisions",
|
|
"/v1/systemone",
|
|
"/systemone",
|
|
"/v1/ocr",
|
|
"/ocr",
|
|
"/v1/rag/",
|
|
"/rag/",
|
|
"/v1/video",
|
|
"/v1/videos",
|
|
"/video/",
|
|
"/videos",
|
|
"/v1/search",
|
|
"/search",
|
|
"/v1/containers",
|
|
"/containers",
|
|
"/v1/evals",
|
|
"/v1/traces",
|
|
"/v1/logs",
|
|
"/v1/memory",
|
|
"/queue/chat/",
|
|
# Google data plane (v1beta is the Google AI Studio version)
|
|
"/v1beta/",
|
|
"/interactions",
|
|
# Provider passthrough
|
|
"/anthropic/",
|
|
"/azure/",
|
|
"/azure_ai/",
|
|
"/azure_speech/",
|
|
"/aws/",
|
|
"/bedrock/",
|
|
"/comprehendmedical",
|
|
"/transcribe",
|
|
"/cohere/",
|
|
"/gemini/",
|
|
"/gigachat/",
|
|
"/google/",
|
|
"/vertex_ai/",
|
|
"/vertex-ai/",
|
|
"/assemblyai/",
|
|
"/eu.assemblyai/",
|
|
"/deepgram/",
|
|
"/fal_ai/",
|
|
"/langfuse/",
|
|
"/vllm/",
|
|
"/mistral/",
|
|
"/typesafe/",
|
|
"/openrouter/",
|
|
"/nvidia_nim/",
|
|
"/groq/",
|
|
"/voyage/",
|
|
"/cursor/",
|
|
"/milvus/",
|
|
"/openai_passthrough/",
|
|
"/tinyfish/",
|
|
# Dynamic provider / toolset passthrough (path templates)
|
|
"/{provider}/",
|
|
"/toolset/",
|
|
# Realtime / streaming
|
|
"/v1/realtime",
|
|
"/realtime",
|
|
# Health & ops
|
|
"/health",
|
|
"/metrics",
|
|
"/watsonx",
|
|
)
|
|
|
|
GATEWAY_EXACT_PATHS: frozenset[str] = frozenset(
|
|
{
|
|
"/",
|
|
"/routes",
|
|
"/openapi.json",
|
|
"/docs",
|
|
"/docs/oauth2-redirect",
|
|
"/redoc",
|
|
"/test",
|
|
"/debug/memory/summary",
|
|
"/api/event_logging/batch",
|
|
}
|
|
)
|
|
|
|
GATEWAY_MOUNT_PATHS: frozenset[str] = frozenset(
|
|
{
|
|
"/metrics",
|
|
}
|
|
)
|