# Incompatibility Between smolagents and OpenAI API Due to additional\_args

**URL:** <https://discuss.huggingface.co/t/incompatibility-between-smolagents-and-openai-api-due-to-additional-args/157772>\
**Category:** Beginners\
**Created:** [June 3, 2025, 12:45am UTC](https://discuss.huggingface.co/t/incompatibility-between-smolagents-and-openai-api-due-to-additional-args/157772 "2025-06-03T00:45:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raj718](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/raj718/32/48696_2.png) [@Raj718](https://discuss.huggingface.co/u/Raj718)\
**Post date:** [June 3, 2025, 12:45am UTC](https://discuss.huggingface.co/t/incompatibility-between-smolagents-and-openai-api-due-to-additional-args/157772/1 "2025-06-03T00:45:57Z")

</div>

I’ve been running into an issue with the smolagents library when using it alongside the latest OpenAI Python client. The problem stems from smolagents passing an unsupported keyword argument, `additional_args`, to the OpenAI API via `openai.Completion.create()`. This causes a `TypeError`, since the OpenAI client doesn’t accept `additional_args`as a valid parameter. It seems that `smolagents` assumes this argument is supported, but that’s no longer the case.

To troubleshoot, I tried multiple approaches. First, I downgraded and upgraded the `openai` package, testing various versions to see if any were compatible. I also created a custom adapter to intercept and remove `additional_args`before calling the API. I added logic to sanitize all arguments being passed, stripping out any unsupported keys. Despite these efforts and repeated testing after each change, the error persisted.

Digging deeper, I found that the root of the problem is in smolagents itself. The way it internally injects `additional_args` into the API request can’t be fully overridden or filtered from outside the library. This means that no matter how we adapt our code, the error will continue unless the library itself is updated. The incompatibility is due to a mismatch between how smolagents handles extra arguments and what the OpenAI API actually supports, and resolving it likely requires a patch to smolagents. If anyone else has encountered this and found a workaround at the library level, I’d really appreciate hearing about your solution.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [June 3, 2025, 2:34am UTC](https://discuss.huggingface.co/t/incompatibility-between-smolagents-and-openai-api-due-to-additional-args/157772/2 "2025-06-03T02:34:43Z")

</div>

It appears that the implementation passes the contents of `additional_args` as keyword arguments rather than passing them as they are, but there may be a bug that causes the implementation to malfunction. No similar issues have been found.

> **[Issues · huggingface/smolagents](https://github.com/huggingface/smolagents/issues)**
>
> 🤗 smolagents: a barebones library for agents that think in code. - Issues · huggingface/smolagents

> <https://github.com/huggingface/smolagents/blob/main/src/smolagents/agents.py#L1506>
