docs: how to pass custom payload to openai style API call?

### URL

_No response_

### Checklist

- [x] I added a very descriptive title to this issue.
- [x] I included a link to the documentation page I am referring to (if applicable).

### Issue with current documentation:

Trying to use local MLX models with LM studio. LM studio supports "auto evicting" models after a certain period of idleness "ttl". They support specifying the TTL parameter as part of the Json payload. The. ChatOpenAI object allows you to pass a custom base URL to support endpoints like lm studio. The stack trace says to put the ttl value in model_kwargs, but it throws an error when I try this also. How to pass the parameter? https://lmstudio.ai/docs/app/api/ttl-and-auto-evict 

```llm = ChatOpenAI(
    base_url="http://localhost:1234/v1",
    temperature=0,
    model="mlx-community/QwQ-32B-4bit",
    ttl=5,
)```

WARNING! ttl is not default parameter.
                    ttl was transferred to model_kwargs.
                    Please confirm that ttl is what you intended.

```llm = ChatOpenAI(
    base_url="http://localhost:1234/v1",
    temperature=0,
    model="mlx-community/QwQ-32B-4bit",
    model_kwargs={"ttl": 5},
)```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[15], line 1
----> 1 ans = llm.invoke("What is the capital of France?")
      2 print(ans.content)

File /opt/anaconda3/envs/slang/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:378, in BaseChatModel.invoke(self, input, config, stop, **kwargs)
    366 @override
    367 def invoke(
    368     self,
   (...)    373     **kwargs: Any,
    374 ) -> BaseMessage:
    375     config = ensure_config(config)
    376     return cast(
    377         "ChatGeneration",
--> 378         self.generate_prompt(
    379             [self._convert_input(input)],
    380             stop=stop,
    381             callbacks=config.get("callbacks"),
    382             tags=config.get("tags"),
    383             metadata=config.get("metadata"),
    384             run_name=config.get("run_name"),
    385             run_id=config.pop("run_id", None),
    386             **kwargs,
    387         ).generations[0][0],
    388     ).message

File /opt/anaconda3/envs/slang/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:963, in BaseChatModel.generate_prompt(self, prompts, stop, callbacks, **kwargs)
    954 @override
    955 def generate_prompt(
    956     self,
   (...)    960     **kwargs: Any,
    961 ) -> LLMResult:
    962     prompt_messages = [p.to_messages() for p in prompts]
--> 963     return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs)

File /opt/anaconda3/envs/slang/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:782, in BaseChatModel.generate(self, messages, stop, callbacks, tags, metadata, run_name, run_id, **kwargs)
    779 for i, m in enumerate(input_messages):
    780     try:
    781         results.append(
--> 782             self._generate_with_cache(
    783                 m,
    784                 stop=stop,
    785                 run_manager=run_managers[i] if run_managers else None,
    786                 **kwargs,
    787             )
    788         )
    789     except BaseException as e:
    790         if run_managers:

File /opt/anaconda3/envs/slang/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:1028, in BaseChatModel._generate_with_cache(self, messages, stop, run_manager, **kwargs)
   1026     result = generate_from_stream(iter(chunks))
   1027 elif inspect.signature(self._generate).parameters.get("run_manager"):
-> 1028     result = self._generate(
   1029         messages, stop=stop, run_manager=run_manager, **kwargs
   1030     )
   1031 else:
   1032     result = self._generate(messages, stop=stop, **kwargs)

File /opt/anaconda3/envs/slang/lib/python3.11/site-packages/langchain_community/chat_models/openai.py:476, in ChatOpenAI._generate(self, messages, stop, run_manager, stream, **kwargs)
    470 message_dicts, params = self._create_message_dicts(messages, stop)
    471 params = {
    472     **params,
    473     **({"stream": stream} if stream is not None else {}),
    474     **kwargs,
    475 }
--> 476 response = self.completion_with_retry(
    477     messages=message_dicts, run_manager=run_manager, **params
    478 )
    479 return self._create_chat_result(response)

File /opt/anaconda3/envs/slang/lib/python3.11/site-packages/langchain_community/chat_models/openai.py:387, in ChatOpenAI.completion_with_retry(self, run_manager, **kwargs)
    385 """Use tenacity to retry the completion call."""
    386 if is_openai_v1():
--> 387     return self.client.create(**kwargs)
    389 retry_decorator = _create_retry_decorator(self, run_manager=run_manager)
    391 @retry_decorator
    392 def _completion_with_retry(**kwargs: Any) -> Any:

File /opt/anaconda3/envs/slang/lib/python3.11/site-packages/openai/_utils/_utils.py:287, in required_args.<locals>.inner.<locals>.wrapper(*args, **kwargs)
    285             msg = f"Missing required argument: {quote(missing[0])}"
    286     raise TypeError(msg)
--> 287 return func(*args, **kwargs)

TypeError: Completions.create() got an unexpected keyword argument 'TTL'


### Idea or request for content:

_No response_

Labels: documentation
State: closed