Error in generating model output: InferenceClient.chat_completion() got an unexpected keyword argument 'last_input_token_count'

For example, if you want to use OpenAI’s LLM, I think you need to use OpenAIServerModel instead of InferenceClientModel.

Maybe like this.

from smolagents import CodeAgent, OpenAIServerModel

model = OpenAIServerModel(model_id="gpt-4o", api_base="https://api.openai.com/v1", api_key=os.getenv("OPENAI_API_KEY", None))
agent = CodeAgent(tools=[], model=model)