+
+
+
OpenAI Compatible Proxy: API Reference
+ LiteLLM is OpenAI Compatible. This means your API Key works with the OpenAI SDK. Just replace the base_url to point to your litellm proxy. Example Below
+
+
+
+ OpenAI Python SDK
+ LlamaIndex
+ Langchain Py
+
+
+
+
+ {`
+import openai
+client = openai.OpenAI(
+ api_key="your_api_key",
+ base_url="http://0.0.0.0:4000" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys
+)
+
+response = client.chat.completions.create(
+ model="gpt-3.5-turbo", # model to send to the proxy
+ messages = [
+ {
+ "role": "user",
+ "content": "this is a test request, write a short poem"
+ }
+ ]
+)
+
+print(response)
+ `}
+
+
+
+
+ {`
+import os, dotenv
+
+from llama_index.llms import AzureOpenAI
+from llama_index.embeddings import AzureOpenAIEmbedding
+from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext
+
+llm = AzureOpenAI(
+ engine="azure-gpt-3.5", # model_name on litellm proxy
+ temperature=0.0,
+ azure_endpoint="http://0.0.0.0:4000", # litellm proxy endpoint
+ api_key="sk-1234", # litellm proxy API Key
+ api_version="2023-07-01-preview",
+)
+
+embed_model = AzureOpenAIEmbedding(
+ deployment_name="azure-embedding-model",
+ azure_endpoint="http://0.0.0.0:4000",
+ api_key="sk-1234",
+ api_version="2023-07-01-preview",
+)
+
+
+documents = SimpleDirectoryReader("llama_index_data").load_data()
+service_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)
+index = VectorStoreIndex.from_documents(documents, service_context=service_context)
+
+query_engine = index.as_query_engine()
+response = query_engine.query("What did the author do growing up?")
+print(response)
+
+ `}
+
+
+
+
+ {`
+from langchain.chat_models import ChatOpenAI
+from langchain.prompts.chat import (
+ ChatPromptTemplate,
+ HumanMessagePromptTemplate,
+ SystemMessagePromptTemplate,
+)
+from langchain.schema import HumanMessage, SystemMessage
+
+chat = ChatOpenAI(
+ openai_api_base="http://0.0.0.0:4000",
+ model = "gpt-3.5-turbo",
+ temperature=0.1
+)
+
+messages = [
+ SystemMessage(
+ content="You are a helpful assistant that im using to make a test request to."
+ ),
+ HumanMessage(
+ content="test from litellm. tell me why it's amazing in 1 sentence"
+ ),
+]
+response = chat(messages)
+
+print(response)
+
+ `}
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
+
+export default APIRef;
+
diff --git a/ui/litellm-dashboard/src/components/leftnav.tsx b/ui/litellm-dashboard/src/components/leftnav.tsx
index dd6ef09707..08e37b744a 100644
--- a/ui/litellm-dashboard/src/components/leftnav.tsx
+++ b/ui/litellm-dashboard/src/components/leftnav.tsx
@@ -46,8 +46,8 @@ const Sidebar: React.FC