Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPTIONS method is not supported when using sglang with the nextchat client #768

Closed
jjiwei opened this issue Jul 27, 2024 · 5 comments
Closed

Comments

@jjiwei
Copy link

jjiwei commented Jul 27, 2024

I am using qwen1.5 model, how to use openai compatible api interface in sglang to use
Launch command: python -m sglang.launch_server --model-path Qwen1.5-72B-Chat-GPTQ-Int4 --tp 2 --enable-p2p-check --port 8000 --host 0.0.0.0
Using openai compatible api reported this error, "OPTIONS /v1/chat/completions HTTP/1.1" 405 Method Not Allowed.
thx

@merrymercy
Copy link
Contributor

  1. Can you successfully run the example in the README? https://github.com/sgl-project/sglang?tab=readme-ov-file#openai-compatible-api
  2. Can you share your code for sending the OAI requests?

@jjiwei
Copy link
Author

jjiwei commented Jul 27, 2024

I'm using the nextchat client to try to connect to sglang's OpenAI-compatible api interface, and I'm using the project's template to get through!
thx
image
image

@merrymercy
Copy link
Contributor

From the log, you can see POST method is supported, but OPTIONS method is not supported.
I am not sure why the nextchat client uses this endpoint.
You can either

  1. Modify nextchat client to not using OPTIONS method.
  2. Help us add the support for OPTIONS here.
    @app.post("/v1/completions")
    async def openai_v1_completions(raw_request: Request):
    return await v1_completions(tokenizer_manager, raw_request)
    @app.post("/v1/chat/completions")
    async def openai_v1_chat_completions(raw_request: Request):
    return await v1_chat_completions(tokenizer_manager, raw_request)
    . You can lean how to do this from ChatGPT: https://chatgpt.com/share/6d9e0db7-4c7c-47b1-9a85-ad05b5b43890

@Ying1123 Ying1123 changed the title How to use OpenAI-compatible APIs. OPTIONS method is not supported when using sglang with the nextchat client Aug 1, 2024
@wizd
Copy link

wizd commented Aug 9, 2024

Easy walk around by adding a proxy: https://github.com/songquanpeng/one-api

@zhyncs
Copy link
Member

zhyncs commented Sep 22, 2024

May you try the latest release? Thanks! ref #1373

@zhyncs zhyncs closed this as completed Sep 22, 2024
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

No branches or pull requests

4 participants