openai-clojure
openai-clojure copied to clipboard
OpenAI endpoint wrong?
I was getting a 404 error when using create-chat-completion. The fix was to set the endpoint to use v1:
(api/create-chat-completion {:model "gpt-5"
:messages messages}
{:api-key (:openai api-keys)
:api-endpoint "https://api.openai.com/v1"})
I did a test & am getting a successful response without needing to override the endpoint:
Request:
(api/create-chat-completion {:model "gpt-5"
:messages [{:role "system" :content "You are a helpful assistant."}
{:role "user" :content "Who won the world series in 2020?"}
{:role "assistant" :content "The Los Angeles Dodgers won the World Series in 2020."}
{:role "user" :content "Where was it played?"}]})
Response:
{:id "chatcmpl-CPtq3PIcXqxZ46VJT11IMgXxqCKjx",
:object "chat.completion",
:created 1760288879,
:model "gpt-5-2025-08-07",
:choices [{:index 0,
:message {:role "assistant",
:content "Globe Life Field in Arlington, Texas.",
:refusal nil,
:annotations []},
:finish_reason "stop"}],
:usage {:prompt_tokens 54,
:completion_tokens 146,
:total_tokens 200,
:prompt_tokens_details {:cached_tokens 0, :audio_tokens 0},
:completion_tokens_details {:reasoning_tokens 128,
:audio_tokens 0,
:accepted_prediction_tokens 0,
:rejected_prediction_tokens 0}},
:service_tier "default",
:system_fingerprint nil}
Ate you still experiencing this?
I tried today and I no-longer need to specify the endpoint. I wonder what happened?
Thanks for your work on this library BTW.