Using Your Own OCI Configuration for SuiteScript Generative AI APIs
If your company needs more than the free monthly allocation of usage for SuiteScript Generative AI APIs, you can configure NetSuite to use your own Oracle Cloud account with the OCI Generative AI service. You can do this in two ways:
-
The
ociConfigparameters in N/llm module methods let you pass your Oracle Cloud account credentials to the OCI Generative AI service’s large language model (LLM). -
The Settings subtab on the AI Preferences page lets you specify your Oracle Cloud account credentials when the Use OCI Configuration To Get Unlimited Usage box is checked. On the SuiteScript subtab, if the Use OCI Credentials for SuiteScript box is checked, these credentials are used when you call N/llm module methods in your scripts.
When you specify your own credentials, your scripts won't draw from the free usage pool in NetSuite for SuiteScript Generative AI APIs. Credentials that you pass using the ociConfig parameters in your scripts override those that you specify on the Settings subtab of the AI Preferences page.
Use these approaches when your company needs more than the free monthly allocation of usage for SuiteScript Generative AI APIs. When using the unlimited use model through your company’s own Oracle Cloud account, your company pays for use of the Oracle Generative AI service. For more information, refer to the Calculating Cost in Generative AI section and the Billing and Cost Management section of the Oracle Cloud Infrastructure Documentation.
Configuring OCI Credentials
For instructions on configuring OCI credentials, see Configure OCI Credentials for AI.
Testing OCI Configuration Parameters in Your Code
To test your OCI configuration parameters, add the getRemainingFreeUsage method to two places in a script that uses the generateText or evaluatePrompt methods: one time before generateText or evaluatePrompt and one time after.
If you didn't specify your OCI configuration parameters on the Settings subtab of the AI Preferences page, update your code to use the ociConfig parameters object.
If the configuration was correct, your script should run without errors, and you should see no change in the number returned by getRemainingFreeUsage.
If the configuration wasn't correct, a SuiteScript error will occur. Verify the following items:
-
Do the OCI configuration parameters contain the correct values for your Oracle Cloud account?
-
Were the NetSuite API Secret IDs entered correctly in your code or in the fields on the Settings subtab of the AI Preferences page? Do they match the secret IDs (and not the secret names) as shown on the API Secrets page?
-
On the API Secrets page in NetSuite, were the OCI fingerprint and OCI private key secrets created correctly?
-
If you aren't using the
ociConfigparameters object, is the Use OCI Credentials for SuiteScript box checked on the SuiteScript subtab of the AI Preferences page?
Fix any items that are incorrect and run the script again. Repeat this step to resolve all configuration errors.