[GH-ISSUE #3109] OpenAI API and templates #27670

Closed
opened 2026-04-22 05:11:37 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @pierreeliseeflory on GitHub (Mar 13, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3109

Hi,

Does the new OpenAI API compatible endpoint /v1/chat/completions uses the default templates defined in the Modefile ?

Thank you

Originally created by @pierreeliseeflory on GitHub (Mar 13, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3109 Hi, Does the new OpenAI API compatible endpoint `/v1/chat/completions` uses the default templates defined in the Modefile ? Thank you
GiteaMirror added the question label 2026-04-22 05:11:38 -05:00
Author
Owner

@BruceMacD commented on GitHub (Mar 15, 2024):

Hi @pierreeliseeflory, the /v1/chat/completions uses the templates defined in the modelfile, it is just mapping the openai request format to our own chat request format so all functionality should be the same. Let me know if you have any other questions.

<!-- gh-comment-id:1999442568 --> @BruceMacD commented on GitHub (Mar 15, 2024): Hi @pierreeliseeflory, the `/v1/chat/completions` uses the templates defined in the modelfile, it is just mapping the openai request format to our own chat request format so all functionality should be the same. Let me know if you have any other questions.
Author
Owner

@vcl00e commented on GitHub (Apr 9, 2024):

Hi, just like to add the mapping logic seems to be here:
c77d45d836/server/prompt.go (L93C4-L93C5)

<!-- gh-comment-id:2045965049 --> @vcl00e commented on GitHub (Apr 9, 2024): Hi, just like to add the mapping logic seems to be here: https://github.com/ollama/ollama/blob/c77d45d836ae98fd19543245180f6412da24e44b/server/prompt.go#L93C4-L93C5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#27670