[GH-ISSUE #2963] Add ability to provide options in OpenAI compatibility endpoints #27580

Open
opened 2026-04-22 05:02:31 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @pseudotensor on GitHub (Mar 6, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2963

It seems one can only set system prompt and hyperparameters like temperature as part of model config file. I'm using the OpenAI API, and ollama ignores system prompt or such hyperparaemters. AFAIK there's no good reason for this.

Am I missing something?

Originally created by @pseudotensor on GitHub (Mar 6, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2963 It seems one can only set system prompt and hyperparameters like temperature as part of model config file. I'm using the OpenAI API, and ollama ignores system prompt or such hyperparaemters. AFAIK there's no good reason for this. Am I missing something?
GiteaMirror added the compatibilityfeature requestapi labels 2026-04-22 05:02:31 -05:00
Author
Owner

@j-schreuder commented on GitHub (Mar 16, 2024):

Somehow I thought this was already a thing and have been spending quite the hours trying different models, prompt finetuning etc. instead. Turns out things are just being clipped still defaulting to 2048 window with models supporting 16K+ as request options are left ignored. Hoping it'll be a quick feature to resolve since it's already on other endpoints.

<!-- gh-comment-id:2002070311 --> @j-schreuder commented on GitHub (Mar 16, 2024): Somehow I thought this was already a thing and have been spending quite the hours trying different models, prompt finetuning etc. instead. Turns out things are just being clipped still defaulting to 2048 window with models supporting 16K+ as request options are left ignored. Hoping it'll be a quick feature to resolve since it's already on other endpoints.
Author
Owner

@AndreasKarasenko commented on GitHub (Jul 19, 2024):

Don't mean to be pushy, but is there any news on this?

<!-- gh-comment-id:2239326735 --> @AndreasKarasenko commented on GitHub (Jul 19, 2024): Don't mean to be pushy, but is there any news on this?
Author
Owner

@tisfeng commented on GitHub (Mar 29, 2025):

Hello, we need this feature, is anyone going to push this forward?

<!-- gh-comment-id:2762998819 --> @tisfeng commented on GitHub (Mar 29, 2025): Hello, we need this feature, is anyone going to push this forward?
Author
Owner

@basnijholt commented on GitHub (Jun 30, 2025):

I've opened PR #11249 that implements options support for the OpenAI API endpoints. This adds support for think and keep_alive parameters and establishes a foundation for future parameter exposure. Would appreciate any feedback!

<!-- gh-comment-id:3021172220 --> @basnijholt commented on GitHub (Jun 30, 2025): I've opened [PR #11249](https://github.com/ollama/ollama/pull/11249/) that implements `options` support for the OpenAI API endpoints. This adds support for `think` and `keep_alive` parameters and establishes a foundation for future parameter exposure. Would appreciate any feedback!
Author
Owner

@flange-ipb commented on GitHub (Jul 21, 2025):

Edit: I'm sorry, this is wrong. The "params" keyword does not work for Ollama's OpenAI compatibility endpoints. On the other hand, this example is valid for Open WebUI's chat completions endpoint (OpenAI client's base_url is http://localhost:3000/api).


I just discovered that the magic keyword to be passed via OpenAI's extra_body is "params".

Example:

sync_client.chat.completions.create(
        model=MODEL,
        messages=[
            {
                "role": "user",
                "content": prompt,
            },
        ],
        extra_body={
            "params": {"num_ctx": CONTEXT_LENGTH, "seed": 123, "temperature": 0.1},
        },
    )
<!-- gh-comment-id:3096197312 --> @flange-ipb commented on GitHub (Jul 21, 2025): **Edit: I'm sorry, this is wrong.** The `"params"` keyword does not work for Ollama's OpenAI compatibility endpoints. On the other hand, this example is valid for Open WebUI's [chat completions endpoint](https://docs.openwebui.com/getting-started/api-endpoints#-chat-completions) (OpenAI client's `base_url` is `http://localhost:3000/api`). --- I just discovered that the magic keyword to be passed via OpenAI's `extra_body` is `"params"`. Example: ```python sync_client.chat.completions.create( model=MODEL, messages=[ { "role": "user", "content": prompt, }, ], extra_body={ "params": {"num_ctx": CONTEXT_LENGTH, "seed": 123, "temperature": 0.1}, }, ) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#27580