Skip to content

Conversation

@ShockiTV
Copy link
Contributor

Fetch the model list from the proxy at the game start (with 5s timeout).
Option is not yet used, just shown in MCM menu.
Hardcoded to use the proxy provider for now.

@Mirrowel Mirrowel self-requested a review November 21, 2025 23:06
Comment on lines +89 to +126
local function get_model_list()
local headers = {
["Content-Type"] = "application/json",
["Authorization"] = "Bearer "..API_KEY,
}

local body_tbl = {}
local requestId = http.send_request(API_MODELS_URL, "GET", headers, body_tbl)

local response
local error

-- ugly 5s busy timeout
local sec = tonumber(os.clock() + 5);
while not response and not error and ( os.clock() < sec ) do
log.info("waiting for models response");
response, error = http.check_response(requestId)
end

log.info("models response " .. inspect(response))

local resultPairs = {}
if response and response.data then
log.info("models list array result" .. inspect(response.data))
for i, v in ipairs(response.data) do
local pair = { v["id"], v["id"] }
log.info("adding the pair: " .. inspect(pair))
table.insert(resultPairs, pair)
end
elseif error then
log.error("models error" .. inspect(error))
else
log.info("models probably timeout")
end
log.info("models final table", inspect(resultPairs))
return resultPairs
end

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reminds me i need to add model list sanitization by default. I keep forgetting.
This returns... like 200+ models with gemini, nvidia combined.

Comment on lines 26 to 28
local API_URL = "http://127.0.0.1:8000/v1/chat/completions"
local API_MODELS_URL = "http://127.0.0.1:8000/v1/models"
local API_KEY = config.PROXY_API_KEY
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, this is a perfect thing to add to advanced settings in MCM - Base URL(API_URL in code). Maybe in the future. including the key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants