llamaIndex - ✅(Solved) Fix [Improvement] Better support for extra_body parameter in OpenAILike [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
run-llama/llama_index#21634Fetched 2026-05-14 03:28:55
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
cross-referenced ×2labeled ×2

Error Message

If we pass it normally, we get this error:

Fix Action

Fix / Workaround

✅ Current Workaround (that works)

PR fix notes

PR #1: feat: add extra_body support to OpenAILike

Description (problem / solution / changelog)

Summary

Adds direct extra_body parameter support to OpenAILike, allowing clean usage with providers that need extra request body parameters (e.g., DeepSeek V4 thinking config).

Problem

When using DeepSeek V4 models with OpenAILike, users currently need to nest parameters like this:

llm = OpenAILike(
    model="deepseek-v4-flash",
    additional_kwargs={
        "extra_body": {"thinking": {"type": "disabled"}}
    },
)

Solution

Add extra_body as a first-class parameter that gets automatically merged into additional_kwargs:

llm = OpenAILike(
    model="deepseek-v4-flash",
    extra_body={"thinking": {"type": "disabled"}},
)

Changes

  • Added extra_body: Optional[Dict[str, Any]] field to OpenAILike
  • Automatically merges into additional_kwargs["extra_body"] in model_post_init
  • Properly merges with any existing extra_body in additional_kwargs

Closes #21634

Changed files

  • llama-index-integrations/llms/llama-index-llms-openai-like/llama_index/llms/openai_like/base.py (modified, +17/-1)

PR #21635: feat: add extra_body support to OpenAILike

Description (problem / solution / changelog)

Summary

Adds direct extra_body parameter support to OpenAILike, allowing clean usage with providers that need extra request body parameters (e.g., DeepSeek V4 thinking config).

Problem

When using DeepSeek V4 models with OpenAILike, users currently need to nest parameters:

llm = OpenAILike(
    model="deepseek-v4-flash",
    additional_kwargs={
        "extra_body": {"thinking": {"type": "disabled"}}
    },
)

Solution

Add extra_body as a first-class parameter:

llm = OpenAILike(
    model="deepseek-v4-flash",
    extra_body={"thinking": {"type": "disabled"}},
)

Changes

  • Added extra_body: Optional[Dict[str, Any]] field
  • Merges into additional_kwargs["extra_body"] in model_post_init
  • Properly merges with existing extra_body in additional_kwargs

Closes #21634

Changed files

  • llama-index-integrations/llms/llama-index-llms-openai-like/llama_index/llms/openai_like/base.py (modified, +17/-1)

Code Example

extra_body = {
    "thinking": {"type": "disabled"}
}

---

additional_kwargs={
    "extra_body": {
        "thinking": {"type": "disabled"}
    }
}

---

llm = OpenAILike(
    model="deepseek-v4-flash",
    api_base="https://api.deepseek.com",
    extra_body={"thinking": {"type": "disabled"}},   # Simple and clean
    ...
)
RAW_BUFFERClick to expand / collapse

🔴 Problem

When using DeepSeek V4 models (deepseek-v4-flash, deepseek-v4-pro, etc.), we need to pass:

extra_body = {
    "thinking": {"type": "disabled"}
}

But OpenAILike does not accept "extra_body" directly.

If we pass it normally, we get this error: AsyncCompletions.create() got an unexpected keyword argument 'thinking'

✅ Current Workaround (that works)

We have to nest it like this:

additional_kwargs={
    "extra_body": {
        "thinking": {"type": "disabled"}
    }
}

✨ Expected Behavior

It should be possible to write it cleanly like this:

llm = OpenAILike(
    model="deepseek-v4-flash",
    api_base="https://api.deepseek.com",
    extra_body={"thinking": {"type": "disabled"}},   # Simple and clean
    ...
)

📋 Environment

  • LlamaIndex version: 0.14.21
  • llama-index-llms-openai-like version: 0.7.2
  • llama-index-llms-openai version: 0.7.8
  • Python version: 3.12
  • Model: deepseek-v4-flash
  • OpenAI client version: latest

💡 Suggested Solution

  • Add direct support for extra_body parameter in OpenAILike class
  • Merge it properly with additional_kwargs
  • Add documentation with example for DeepSeek V4 and similar models

Why It Matters: DeepSeek V4 and other new reasoning models are getting popular. Making this easier will improve developer experience for many users.

Thank you!

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

llamaIndex - ✅(Solved) Fix [Improvement] Better support for extra_body parameter in OpenAILike [2 pull requests, 1 participants]