2024-05-21 20:53:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
									
										
										
										
											2025-03-03 15:42:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								sidebar_position: 1
							 
						 
					
						
							
								
									
										
										
										
											2024-05-21 20:53:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								slug: /llm_api_key_setup
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-30 16:56:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# Configure model API key
  
						 
					
						
							
								
									
										
										
										
											2024-05-21 20:53:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-30 16:56:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								An API key is required for RAGFlow to interact with an online AI model. This guide provides information about setting your model API key in RAGFlow.
							 
						 
					
						
							
								
									
										
										
										
											2024-05-21 20:53:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-30 16:56:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Get model API key
  
						 
					
						
							
								
									
										
										
										
											2024-05-21 20:53:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-03 15:42:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								RAGFlow supports most mainstream LLMs. Please refer to [Supported Models ](../../references/supported_models.mdx ) for a complete list of supported models. You will need to apply for your model API key online. Note that most LLM providers grant newly-created accounts trial credit, which will expire in a couple of months, or a promotional amount of free quota.
							 
						 
					
						
							
								
									
										
										
										
											2024-05-21 20:53:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 13:52:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								:::note
							 
						 
					
						
							
								
									
										
										
										
											2024-10-30 19:40:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								If you find your online LLM is not on the list, don't feel disheartened. The list is expanding, and you can [file a feature request ](https://github.com/infiniflow/ragflow/issues/new?assignees=&labels=feature+request&projects=&template=feature_request.yml&title=%5BFeature+Request%5D%3A+ ) with us! Alternatively, if you have customized or locally-deployed models, you can [bind them to RAGFlow using Ollama, Xinference, or LocalAI ](./deploy_local_llm.mdx ).
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 13:52:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								:::
							 
						 
					
						
							
								
									
										
										
										
											2024-05-21 20:53:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-30 16:56:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Configure model API key
  
						 
					
						
							
								
									
										
										
										
											2024-05-21 20:53:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-30 16:56:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								You have two options for configuring your model API key:
							 
						 
					
						
							
								
									
										
										
										
											2024-05-21 20:53:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-11-12 15:56:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  Configure it in **service_conf.yaml.template**  before starting RAGFlow. 
						 
					
						
							
								
									
										
										
										
											2024-12-07 11:04:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  Configure it on the **Model providers**  page after logging into RAGFlow. 
						 
					
						
							
								
									
										
										
										
											2024-05-21 20:53:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-30 16:56:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Configure model API key before starting up RAGFlow
  
						 
					
						
							
								
									
										
										
										
											2024-06-11 13:52:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Navigate to ** ./docker/ragflow**. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								2.  Find entry **user_default_llm** : 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   -  Update `factory`  with your chosen LLM.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   -  Update `api_key`  with yours.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   -  Update `base_url`  if you use a proxy to connect to the remote service.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								3.  Reboot your system for your changes to take effect. 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:50:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								4.  Log into RAGFlow.   
						 
					
						
							
								
									
										
										
										
											2025-03-03 15:42:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   _After logging into RAGFlow, you will find your chosen model appears under **Added models** on the **Model providers** page._ 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 13:52:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-30 16:56:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Configure model API key after logging into RAGFlow
  
						 
					
						
							
								
									
										
										
										
											2024-06-11 13:52:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								:::caution WARNING
							 
						 
					
						
							
								
									
										
										
										
											2024-11-12 15:56:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								After logging into RAGFlow, configuring your model API key through the **service_conf.yaml.template**  file will no longer take effect.
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 13:52:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								:::
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-07 11:04:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								After logging into RAGFlow, you can *only*  configure API Key on the **Model providers**  page:
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 13:52:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-07 11:04:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								1.  Click on your logo on the top right of the page ** >** **Model providers** . 
						 
					
						
							
								
									
										
										
										
											2024-06-11 13:52:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								2.  Find your model card under **Models to be added**  and click **Add the model** : 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   
							 
						 
					
						
							
								
									
										
										
										
											2024-10-30 16:56:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								3.  Paste your model API key. 
						 
					
						
							
								
									
										
										
										
											2024-06-11 13:52:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								4.  Fill in your base URL if you use a proxy to connect to the remote service. 
						 
					
						
							
								
									
										
										
										
											2024-06-11 18:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								5.  Click **OK**  to confirm your changes. 
						 
					
						
							
								
									
										
										
										
											2024-06-11 13:52:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								:::note
							 
						 
					
						
							
								
									
										
										
										
											2025-05-22 17:02:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								To update an existing model API key:
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 13:52:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								:::