autogen/website/docs/Use-Cases/enhanced_inference.md
API unification  `autogen.OpenAIWrapper.create()` can be used to create completions for both chat and non-chat models, and both OpenAI API and Azure OpenAI API.  ```python from autogen import OpenAIWrapper # OpenAI endpoint client = OpenAIWrapper() # ChatCompletion response = client.create(messages=[{"role": "user", "content": "2+2="}], model="gpt-3.5-turbo") # extract the response text print(client.extract_text_or_completion_object(response)) # get cost of this completion print(response.cost) # Azure OpenAI endpoint client = OpenAIWrapper(api_key=..., base_url=..., api_version=..., api_type="azure") # Completion response = client.create(prompt="2+2=", model="gpt-3.5-turbo-instruct") # extract the response text print(client.extract_text_or_completion_object(response))  ```  For local LLMs, one can spin up an endpoint using a package like [FastChat](https://github.com/lm-sys/FastChat), and then use the same API to send a request. See [here](/blog/2023/07/14/Local-LLMs) for examples on how to make inference with local LLMs.  For custom model clients, one can register the client with `autogen.OpenAIWrapper.register_model_client` and then use the same API to send a request. See [here](/blog/2024/01/26/Custom-Models) for examples on how to make inference with custom model clients. 