|
| 1 | +=========== |
| 2 | +AI API keys |
| 3 | +=========== |
| 4 | + |
| 5 | +.. |AI| replace:: :abbr:`AI (artificial intelligence)` |
| 6 | +.. |API| replace:: :abbr:`API (application program interface)` |
| 7 | + |
| 8 | +Odoo's *AI* application settings contain options to control which |AI| provider the app utilizes, |
| 9 | +manage |API| credentials, and define the default prompts. Odoo supports both Gemini and OpenAI |
| 10 | +(ChatGPT) as providers in the *AI* application. |
| 11 | + |
| 12 | +Some |AI| features can be used without the *AI* app installed. However, to use custom |API| |
| 13 | +credentials or to alter the |AI| provider used for a specific agent, the app **must** be installed. |
| 14 | + |
| 15 | +.. important:: |
| 16 | + While users can add their own |API| keys, it is **not** required. However, some organizations may |
| 17 | + prefer to use their own keys for greater control over permissions, version updates, or internal |
| 18 | + policy compliance. |
| 19 | + |
| 20 | +.. _ai/apikeys/chatgpt: |
| 21 | + |
| 22 | +Create API key for ChatGPT |
| 23 | +========================== |
| 24 | + |
| 25 | +To create an |API| key for ChatGPT, visit `API Key Page <https://platform.openai.com/api-keys>`_. |
| 26 | +Click :guilabel:`Login` and enter the login information for the OpenAI account. |
| 27 | + |
| 28 | +On the *API Keys* page, click :guilabel:`Create new secret key`. |
| 29 | + |
| 30 | +.. image:: apikeys/create-new-key.png |
| 31 | + :alt: The API keys page in OpenAI. |
| 32 | + |
| 33 | +This opens the :guilabel:`Create new secret key` pop-up. Select the owner of the new key: |
| 34 | + |
| 35 | +- :guilabel:`You`: the new key is tied to the user account and can make requests against the |
| 36 | + selected project. If the user is removed from the organization or project, this key is disabled. |
| 37 | +- :guilabel:`Service account`: creates a new bot member, or service account, of the project. The key |
| 38 | + is attached to the bot member. |
| 39 | + |
| 40 | +Next, enter a :guilabel:`Name` for this key. This is optional, but recommended. Then, select the |
| 41 | +:guilabel:`Project` from the drop-down menu. Finally, select the appropriate |
| 42 | +:guilabel:`Permissions`. |
| 43 | + |
| 44 | +.. image:: apikeys/create-key-popup.png |
| 45 | + :alt: The popup where new api keys are created in OpenAI. |
| 46 | + |
| 47 | +.. note:: |
| 48 | + Setting the :guilabel:`Permissions` to :guilabel:`Restricted` requires setting the read and write |
| 49 | + permissions to multiple resources individually. For more information, see `OpenAI Platform Docs |
| 50 | + <https://platform.openai.com/docs/overview>`_. |
| 51 | + |
| 52 | +Click :guilabel:`Create secret key`. On the resulting pop-up, click :guilabel:`Copy` to copy the new |
| 53 | +key. |
| 54 | + |
| 55 | +.. warning:: |
| 56 | + Once this pop-up closes, the key **cannot** be viewed again. If it is lost, a new key will need |
| 57 | + to be created. |
| 58 | + |
| 59 | + .. image:: apikeys/save-openai-key.png |
| 60 | + :alt: The popup displaying the newly created OpenAI key. |
| 61 | + |
| 62 | +Return to Odoo, and navigate to :menuselection:`AI app --> Configuration --> Settings`. Under |
| 63 | +*Providers*, tick the checkbox for :guilabel:`Use your own ChatGPT account`, and paste the new key |
| 64 | +in the :guilabel:`Key` field. Click :guilabel:`Save` when finished. |
| 65 | + |
| 66 | +.. _ai/apikeys/gemini: |
| 67 | + |
| 68 | +Create an API key for Google Gemini |
| 69 | +=================================== |
| 70 | + |
| 71 | +To create an |API| key for Google Gemini, visit `API Keys |
| 72 | +<https://aistudio.google.com/app/api-keys>`_. Enter the login information for the Google account, |
| 73 | +and click :guilabel:`Next` to open Google |AI| Studio. In the top right corner, click |
| 74 | +:guilabel:`Create API Key`. |
| 75 | + |
| 76 | +.. image:: apikeys/create-gemini-api-key.png |
| 77 | + :alt: The Gemini api keys page. |
| 78 | + |
| 79 | +On the *Create a new key* pop-up, enter a title in the :guilabel:`Name your key` field. Next, use |
| 80 | +the :guilabel:`Choose an imported project` drop-down to select a project, or import a new one. Click |
| 81 | +:guilabel:`Create key`. |
| 82 | + |
| 83 | +On the *API Keys* page, find the appropriate key and click the copy icon. |
| 84 | + |
| 85 | +.. image:: apikeys/copy-gemini-key.png |
| 86 | + :alt: The new Gemini key with the copy button highlighted. |
| 87 | + |
| 88 | +Return to Odoo, and navigate to :menuselection:`AI app --> Configuration --> Settings`. Under |
| 89 | +*Providers*, tick the checkbox for :guilabel:`Use your own Google Gemini account`, and paste the new |
| 90 | +key in the :guilabel:`Key` field. Click :guilabel:`Save` when finished. |
| 91 | + |
| 92 | +Pricing |
| 93 | +======= |
| 94 | + |
| 95 | +Utilizing |API| keys for |AI| may require additional fees through the provider. The exact costs |
| 96 | +depend on the |AI| model used and the account type with each provider. |
| 97 | + |
| 98 | +For additional information on :ref:`ChatGPT <ai/apikeys/chatgpt>` pricing, visit `OpenAI API Pricing |
| 99 | +<https://openai.com/api/pricing/>`_. |
| 100 | + |
| 101 | +For additional information on :ref:`Google Gemini <ai/apikeys/gemini>` pricing, visit `Gemini API |
| 102 | +Pricing <https://ai.google.dev/gemini-api/docs/pricing>`_. |
0 commit comments