@@ -155,19 +155,27 @@ async def _non_stream_proxy(backend_url: str, request: Request, json_body: dict)
155155 raise HTTPException (status_code = 500 , detail = f"Internal proxy error: { e } " )
156156
157157
158+ @app .post ("/v1/responses" , summary = "/v1/responses " )
158159@app .post ("/v1/completions" , summary = "/v1/completions" )
159160@app .post ("/v1/chat/completions" , summary = "/v1/chat/completions" )
160- async def post_completions (request : Request ):
161+ @app .post ("/v1/embeddings" , summary = "/v1/embeddings" )
162+ @app .post ("/v1/moderations" , summary = "/v1/moderations" )
163+ @app .post ("/v1/images/generations" , summary = "/v1/images/generations" )
164+ @app .post ("/v1/images/edits" , summary = "/v1/images/edits" )
165+ @app .post ("/v1/images/variations" , summary = "/v1/images/variations" )
166+ @app .post ("/v1/audio/transcriptions" , summary = "/v1/audio/transcriptions" )
167+ @app .post ("/v1/audio/speech" , summary = "/v1/audio/speech" )
168+ @app .post ("/v1/rerank" , summary = "/v1/rerank" )
169+ async def router (request : Request ):
161170 backend_url , json_body = await _get_routing_info (request )
162-
171+ # 流式接口
163172 if json_body .get ("stream" , False ):
164- logger .info ("Handling as STREAMING request" )
165173 return StreamingResponse (
166174 _stream_proxy (backend_url , request , json_body ),
167175 media_type = "text/event-stream" ,
168176 )
177+ # 非流式接口
169178 else :
170- logger .info ("Handling as NON-STREAMING request" )
171179 return await _non_stream_proxy (backend_url , request , json_body )
172180
173181
@@ -176,7 +184,7 @@ async def post_completions(request: Request):
176184
177185 # 你需要通过环境变量来设置模型,例如:
178186 # MODELS="gpt-4=http://localhost:8080,llama=http://localhost:8081" uvicorn streaming_proxy:app --host 0.0.0.0 --port 8000
179- os .environ ["MODELS" ] = "qwen3 =https://miyun.archermind.com"
187+ os .environ ["MODELS" ] = "Conan-embedding-v1 =https://miyun.archermind.com"
180188 if not os .environ .get ("MODELS" ):
181189 logger .warning (
182190 "MODELS environment variable is not set. Example: MODELS='model_name=http://backend_url'"
0 commit comments