Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ llm:
# Qwen Max: base_url: "https://dashscope.aliyuncs.com/compatible-mode/v1" model: "qwen-max"
# OpenAI GPT-4o: base_url: "https://api.openai.com/v1" model: "gpt-4o"
# DeepSeek: base_url: "https://api.deepseek.com" model: "deepseek-chat"
# Gemini base_url: "https://generativelanguage.googleapis.com/v1beta" model: "gemini-3-flash-preview"
# Ollama (Local): base_url: "http://localhost:11434/v1" model: "llama3.2"

# ==================== ComfyUI Configuration ====================
Expand Down
6 changes: 6 additions & 0 deletions pixelle_video/llm_presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
"model": "moonshot-v1-8k",
"api_key_url": "https://platform.moonshot.cn/console/api-keys",
},
{
"name": "Gemini",
"base_url": "https://generativelanguage.googleapis.com/v1beta",
"model": "gemini-3-flash-preview",
"api_key_url": "https://aistudio.google.com/app/api-keys",
},
]


Expand Down
17 changes: 13 additions & 4 deletions pixelle_video/utils/llm_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,27 @@ def fetch_available_models(api_key: str, base_url: str, timeout: float = 10.0) -
"""
# Normalize base_url - ensure it ends with /v1 or similar
base_url = base_url.rstrip("/")


for_gemini = False
# Build the models endpoint URL
# Handle cases where base_url might or might not include /v1
if base_url.endswith("/v1"):
models_url = f"{base_url}/models"
else:
models_url = f"{base_url}/v1/models"


if base_url.endswith("v1beta"):
for_gemini = True

headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
}

if for_gemini:
models_url = f"{base_url}/models"
headers = {"x-goog-api-key": f"{api_key}",
"Content-Type": "application/json"
}
logger.debug(f"Fetching models from: {models_url}")

with httpx.Client(timeout=timeout) as client:
Expand All @@ -62,7 +70,8 @@ def fetch_available_models(api_key: str, base_url: str, timeout: float = 10.0) -

data = response.json()
models = [model["id"] for model in data.get("data", [])]

if for_gemini:
models = [model["name"] for model in data.get("models", [])]
# Sort models alphabetically for better UX
models.sort()

Expand Down