Self-Hosted DeepSeek Model used in OpenAI-Codex - Endpoint Issue (Https related)
Hey everyone, I am currently trying to use a self hosted deepseek model within codex, so I have set myself up with a devcontainer containing everything i need (node, npm, litellm, openai, ... ). I have posted the same question in a codex issue.
i have configured litellm like that:
model_list:
- model_name: deepseek-70b
litellm_params:
provider: openai
model: openai/deepseek-ai/DeepSeek-R1-Distill-Llama-70B
api_base: https://our_inference_ip:30000/v1
api_key: os.environ/OPENAI_API_KEY
litellm_settings:
ssl_verify: "/etc/ssl/certs/ca-certificates.crt"
drop_params: true
in devcontainer.json:
"containerEnv": {
"OPENAI_BASE_URL": "http://0.0.0.0:4000",
"OPENAI_API_KEY": "sk-test"
}
our model can only be reached with a certificate. I have added the cert file within the container, so that it is possible for me to curl for a response from litellm like this:
curl -v -H "Authorization: Bearer sk-test" -H "Content-Type: application/json" -d '{"model":"deepseek-70b","messages":[{"role":"user","content":"2+2"}]}' http://localhost:4000/v1/chat/completions
I am able to receive answers form this endpoint. Here comes the codex related problem:
remember the base_url and api_key are already set. I run the following command:
codex --provider openai --model deepseek-70b -q "what is 2+2?"
i receive:
codex --provider openai --model deepseek-70b -q "what is 2+2?" {"role":"user","content":[{"type":"input_text","text":"what is 2+2?"}],"type":"message"} {"id":"error-1745578428541","type":"message","role":"system","content":[{"type":"input_text","text":"⚠️ OpenAI rejected the request. Error details: Status: 404, Code: 404, Type: unknown, Message: 404 litellm.NotFoundError: NotFoundError: OpenAIException - {\"detail\":\"Not Found\"}. Please verify your settings and try again."}]}
on my litellm side of things i receive this error:
httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://10.244.192.53:30000/v1/responses' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
litellm.llms.base_llm.chat.transformation.BaseLLMException: {"detail":"Not Found"}
litellm.exceptions.NotFoundError: litellm.NotFoundError: NotFoundError: OpenAIException - {"detail":"Not Found"}
the question is "why is codex looking for /responses endpoint?"? can i somehow provide that with my litellm setup? is there an easy way to simply redirect the request to the right endpoint?