You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

llm_api_key_setup.md 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ---
  2. sidebar_position: 5
  3. slug: /llm_api_key_setup
  4. ---
  5. # Configure model API key
  6. 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.
  7. ## Get model API key
  8. 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.
  9. :::note
  10. 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).
  11. :::
  12. ## Configure model API key
  13. You have two options for configuring your model API key:
  14. - Configure it in **service_conf.yaml.template** before starting RAGFlow.
  15. - Configure it on the **Model Providers** page after logging into RAGFlow.
  16. ### Configure model API key before starting up RAGFlow
  17. 1. Navigate to **./docker/ragflow**.
  18. 2. Find entry **user_default_llm**:
  19. - Update `factory` with your chosen LLM.
  20. - Update `api_key` with yours.
  21. - Update `base_url` if you use a proxy to connect to the remote service.
  22. 3. Reboot your system for your changes to take effect.
  23. 4. Log into RAGFlow.
  24. *After logging into RAGFlow, you will find your chosen model appears under **Added models** on the **Model Providers** page.*
  25. ### Configure model API key after logging into RAGFlow
  26. :::caution WARNING
  27. After logging into RAGFlow, configuring your model API key through the **service_conf.yaml.template** file will no longer take effect.
  28. :::
  29. After logging into RAGFlow, you can *only* configure API Key on the **Model Providers** page:
  30. 1. Click on your logo on the top right of the page **>** **Model Providers**.
  31. 2. Find your model card under **Models to be added** and click **Add the model**:
  32. ![add model](https://github.com/infiniflow/ragflow/assets/93570324/07e43f63-367c-4c9c-8ed3-8a3a24703f4e)
  33. 3. Paste your model API key.
  34. 4. Fill in your base URL if you use a proxy to connect to the remote service.
  35. 5. Click **OK** to confirm your changes.
  36. :::note
  37. To update an existing model API key at a later point:
  38. ![update api key](https://github.com/infiniflow/ragflow/assets/93570324/0bfba679-33f7-4f6b-9ed6-f0e6e4b228ad)
  39. :::