mirror of
https://github.com/Physton/sd-webui-prompt-all-in-one.git
synced 2026-12-03 18:42:25 +07:00
[GH-ISSUE #358] [Bug] Colons in ChatGPT API key appear to break request #310
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Physton/sd-webui-prompt-all-in-one#310
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Nitrousoxide on GitHub (Mar 22, 2025).
Original GitHub issue: https://github.com/Physton/sd-webui-prompt-all-in-one/issues/358
Issue Feedback
Describe the Issue
I am attempting to point the chatgpt function to a self-hosted LLM instead of the public chatgpt instances. I am using this proxy server to create an authentication front-end for the LLMs so that not just anyone can make api requests
It appears to follow the standard curl api request format for openai, with an example one like this entered into my terminal correctly returning a result:
curl -X POST -H "Authorization: Bearer user1:key1" http://localhost:8080/api/generate --data "{\"model\":\"llama3:latest\",\"prompt\": \"Once upon a time,\",\"stream\":false,\"temperature\": 0.3,\"max_tokens\": 1024}"(obviously this is not the real user/key combo used for my request)
However, when I attempt to use my user/key combo in the gpt plugin I get a 404 error. If I surround the api key with single (or double) quotes I am seeing the request in the logs in my proxy server, and your plugin reports a 403, rather than a 404 error. However, it appears to be passing the key in that case with the surrounding quotes as part of the key. I would also note that my key does not contain any non-alphanumeric characters. I chose to exclude those to avoid possible syntax issues like this. The only non-alphanumeric character entered into the "api" field in your plugin is ":" to seperate the user and key.
As an example here's what the log looks like (with the keys obviously obfuscated)
In short, it appears like certain characters in the API key will cause the entire curl request to 404, and that attempting to quote the api key to ensure a : isn't breaking the command in some way sends the api key with the quotes included.
Maybe this is a vary particular thing with this specific proxy server that uses the format
user1:key1which isn't the exact format for an api key that openai uses, but sanitizing the api key input so that other characters can be used as part of it for potentially a larger set of api providers may be a good addition.Steps to Reproduce
Enter API key with format 'user1:key1'
Get 404 for chatgpt request
Screenshot or log
No response
OS
Linux
Browser
Firefox
Stable Diffusion WebUI version
f1.7.0-v1.10.1RC-latest-2145-g3640d0b4
Extension version
21654832Python version
3.10.12
Gradio version
3.41.2