# SuiteScript N/llm: Building Generative AI Inside NetSuite, and Knowing Its Limits

> Source: https://netray.co/erp-ai/netsuite-suitescript-n-llm-generative-ai
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: AI for ERP

## Short answer

The SuiteScript N/llm module lets server-side scripts call large language models hosted on Oracle Cloud Infrastructure Generative AI directly from NetSuite, to generate text, run Prompt Studio prompts, ground answers in supplied documents and create embeddings. It suits small, in-context features inside NetSuite; larger retrieval, private model or cross-system needs usually belong outside.

## Kind

platform

## Erp Family

oracle

## Erp Products

- NetSuite SuiteScript 2.1
- N/llm module
- NetSuite Prompt Studio
- OCI Generative AI

## Industries

- Manufacturing
- Distribution
- Software
- Retail

## Region

Global

## Persona

SuiteCloud Developer

## Eyebrow

SuiteScript generative AI

## Intro

Before N/llm, adding generative AI to a NetSuite customization meant calling an external API from SuiteScript with N/https, storing an API key somewhere, and hoping legal had reviewed where the data went. N/llm gives SuiteCloud developers a native module instead. A Suitelet, RESTlet, user event or scheduled script can send a prompt to a model running on OCI Generative AI and get text back, with Oracle handling the model hosting.

That makes certain features almost trivial: summarizing a long case thread on a support case record, drafting a customer email from a sales order, classifying an incoming vendor bill memo, or answering a question over a handful of documents passed in as context. Developers who know SuiteScript can ship these in days, and the data stays within Oracle's cloud rather than going to a separate AI vendor.

The limits are worth knowing before you design around it. There is a monthly free usage allowance per account, after which you either stop or connect your own OCI Generative AI account and pay Oracle for usage. Model choice is limited to the families Oracle offers through the module. Scripts still run under NetSuite governance limits and timeouts. And document grounding means passing the documents in yourself; there is no managed vector store or search index across your whole account.

This page covers what the module does, the patterns that work, the ones that strain it, and how to decide between N/llm, the AI Connector Service and an external retrieval layer with your own models.

## Pain Points

### Free usage runs out in production

**Detail:** A feature that works well in sandbox can exhaust the monthly free allowance once hundreds of users trigger it. Without a plan for OCI billing or usage caps, the feature fails at month end.

### No account-wide retrieval

**Detail:** N/llm can ground an answer in documents you pass to the call, but it does not search your account for you. Building retrieval over thousands of records needs embeddings, storage and search that you design.

### Governance and timeouts

**Detail:** Model calls take seconds. In a user event script or a busy RESTlet, that latency and the governance cost per call can make record saves slow or hit limits.

### Prompt sprawl across scripts

**Detail:** Prompts hard-coded in many scripts are hard to review and change. Prompt Studio helps, but only if the team adopts it consistently.

### Limited model choice

**Detail:** You use the model families Oracle exposes. If you need a specific model, a fine-tuned model or an on-prem model for data reasons, N/llm is not the path.

## Use Cases

### Case and thread summaries

**Description:** A Suitelet or client-triggered RESTlet summarizes a support case's messages so the next agent sees the history in a paragraph.

**Erp Objects:** SupportCase, Message records, N/llm generateText

**Outcome:** Cuts the read-in time on long cases; a natural first feature because the input is already text.

### Customer communication drafts

**Description:** Drafts an order confirmation, delay notice or collection reminder from sales order, fulfillment or invoice fields for a user to edit.

**Erp Objects:** SalesOrder, ItemFulfillment, Invoice, N/llm generateText or evaluatePrompt with a Prompt Studio prompt

**Outcome:** Faster, more consistent messages; keep a human send step.

### Vendor bill memo classification

**Description:** Classifies free-text memos or descriptions on vendor bills into expense categories or flags ones that need review.

**Erp Objects:** VendorBill, expense lines, custom list for categories, N/llm

**Outcome:** Speeds coding of routine bills; low-confidence results go to a reviewer.

### Grounded Q&A over a few documents

**Description:** Answers a question about a policy or contract by passing the relevant document text to the call as source documents and asking for cited answers.

**Erp Objects:** File Cabinet documents, N/llm createDocument and generateText with documents

**Outcome:** Works well when the right documents are known in advance; not a substitute for search across many files.

### Semantic matching with embeddings

**Description:** Creates embeddings for item descriptions to find likely duplicates or match a customer's free-text request to catalog items.

**Erp Objects:** Item records, N/llm embed, custom record to store vectors

**Outcome:** Useful for moderate catalogs; large catalogs usually need an external vector index.

### Item and description enrichment

**Description:** Generates or tidies sales descriptions, web copy and attributes from engineering fields, for review before publishing.

**Erp Objects:** Item, custom item fields, N/llm generateText

**Outcome:** Saves writing time for catalog teams; Text Enhance may already cover simple cases without code.

### Scheduled digest generation

**Description:** A scheduled or map/reduce script assembles exception lists and asks the model to write a short plain-language digest for a manager.

**Erp Objects:** Saved search results, scheduled script, N/llm, email via N/email

**Outcome:** Turns a raw exception list into something people read; watch usage volume.

## Architecture

**Overview:** SuiteScript calls N/llm, which sends prompts to models hosted on OCI Generative AI and returns responses. Prompts can be managed in Prompt Studio. Anything beyond small in-context tasks typically moves to an external layer.

**Layers:**

#### Trigger script

**Detail:** Suitelet, RESTlet, user event, scheduled or map/reduce script written in SuiteScript 2.1 that gathers record data and decides when to call the model.

#### N/llm calls

**Detail:** generateText for free-form prompts with optional chat history and documents, evaluatePrompt for Prompt Studio prompts with variables, embed for vectors, and functions to check remaining free usage.

#### Prompt Studio

**Detail:** Central place in NetSuite to manage prompts and their variables, so changes do not need script deployments and prompts can be reviewed.

#### Model hosting

**Detail:** OCI Generative AI models selected through the module's model family options; usage beyond the free allowance is billed through an OCI account you connect.

#### External layer when needed

**Detail:** For account-wide retrieval, private models, cross-system data or heavy volume, an external service calls NetSuite through SuiteQL and RESTlets and runs its own models.

## Deployment Options

### N/llm only

**Fit:** Small features inside NetSuite records and screens

**Detail:** Native, fast to build, data stays in Oracle's cloud, within free usage or OCI billing.

### N/llm plus Prompt Studio governance

**Fit:** Teams shipping several AI features

**Detail:** Prompts managed centrally, usage tracked, and a review step for prompt changes.

### External retrieval and private models

**Fit:** Account-wide Q&A, sensitive data, multi-system answers

**Detail:** Open-weight models on vLLM in a private cloud or on-prem, with retrieval over NetSuite and documents, calling NetSuite through an integration role.

## Compliance

### Review Oracle's terms for OCI Generative AI usage through N/llm and document which record fields your scripts send in prompts.

**Framework:** Data handling

### Keep model output advisory for financial fields; scripts should not post journals or change amounts based on model output without approval.

**Framework:** SOX

### Minimize personal data in prompts; send IDs and needed fields only, not whole customer records.

**Framework:** Privacy (GDPR, CCPA)

### Treat prompts as code: version them, review changes, and test in sandbox before production.

**Framework:** Change management

## Integration Notes

- N/llm is server-side SuiteScript 2.1; call it from Suitelets, RESTlets or server scripts, not from client scripts directly.
- Check remaining free usage in code and fail gracefully when the allowance is exhausted, or connect your own OCI Generative AI configuration for paid usage.
- Avoid model calls in synchronous user event scripts on high-volume records; move them to scheduled or map/reduce processing where latency does not block saves.
- Use Prompt Studio and evaluatePrompt for prompts business users may want to adjust, so a wording change does not require a deployment.
- When grounding with documents, pass only the relevant excerpts; large inputs cost more and dilute the answer.
- Store embeddings in a custom record only for modest volumes; beyond that, use an external vector index.
- Check Oracle's release notes for model family availability and regional support in your data center.

## Product Fit

### Custom build

**Why:** N/llm features, Prompt Studio setup and SuiteScript design, plus external retrieval when a use case outgrows the module.

### ERPray

**Why:** Account-wide grounded Q&A and agents over NetSuite with private model hosting, for needs beyond in-record generation.

## Engagement

### Use-case selection

**Duration:** 1 week

**Deliverables:**

- Shortlist of in-record AI features
- Volume and usage estimate against free allowance
- Decision on N/llm versus external layer per use case

### Build

**Duration:** 2-4 weeks

**Deliverables:**

- SuiteScript with N/llm calls
- Prompt Studio prompts with variables
- Usage checks and graceful failure

### Test

**Duration:** 1-2 weeks

**Deliverables:**

- Sandbox test set with expected outputs
- Latency and governance measurements
- User acceptance with a pilot group

### Operate

**Duration:** Ongoing

**Deliverables:**

- Usage monitoring and OCI billing review
- Prompt change process
- Release-note review each NetSuite release

## Buyer Questions

- How many calls per month will this feature make, and what happens when the free allowance runs out?
- Which record fields go into prompts, and are any sensitive?
- Is the model call synchronous to a record save, and what is the latency impact?
- Who owns prompts, and how are changes reviewed?
- Does this need account-wide retrieval, and if so where will the index live?
- Would a built-in feature such as Text Enhance cover this without code?

## Faq

### What is the SuiteScript N/llm module?

**Answer:** N/llm is a SuiteScript 2.1 module that lets server-side scripts call large language models hosted on OCI Generative AI. It supports generating text from a prompt, continuing a chat with history, grounding responses in documents you supply, running prompts managed in Prompt Studio, and creating embeddings. It brings generative AI into NetSuite customizations without a separate AI vendor.

### Is N/llm free to use?

**Answer:** Each account gets a monthly free usage allowance, and scripts can check how much remains. Beyond that, you can connect your own OCI Generative AI account so usage is billed by Oracle, or design features to stop gracefully. Exact allowances and pricing change, so check current Oracle documentation and estimate your volume before rolling a feature out widely.

### Which models does N/llm use?

**Answer:** It uses model families that Oracle offers through OCI Generative AI and exposes in the module, which have included Cohere and Meta Llama models. The list has changed over releases. If you need a particular model, a fine-tuned one, or a model running in your own environment, you will need an external integration instead.

### Can N/llm answer questions across all my NetSuite data?

**Answer:** Not on its own. It answers from what you put in the prompt and the documents you pass. To answer questions across your account, you need retrieval: queries or searches that find the right records first. For broad Q&A, an external layer with SuiteQL access and its own index is usually more practical.

### How is N/llm different from the NetSuite AI Connector Service?

**Answer:** N/llm runs inside NetSuite and lets your scripts use a model to build features in records and screens. The AI Connector Service runs the other way: it lets an external AI client, such as Claude, call into NetSuite through MCP. Many companies will use both for different needs.

### What is Prompt Studio in NetSuite?

**Answer:** Prompt Studio is where administrators manage prompts used by NetSuite generative AI features and by scripts calling evaluatePrompt. It lets you edit prompt wording and variables without redeploying scripts and gives you one place to review what the model is being asked to do.

### When should I not use N/llm?

**Answer:** Skip it when data cannot be processed in Oracle's generative AI service under your policies, when you need a specific or private model, when the feature needs retrieval across thousands of records or other systems, or when call volume would make OCI costs or governance limits a problem. An external layer handles those better.

## Search terms

suitescript n/llm, netsuite n/llm module, suitescript generative ai, n/llm evaluateprompt, suitescript llm api, netsuite llm, netsuite prompt studio, n/llm generatetext, netsuite ai suitescript, netsuite machine learning, netsuite embeddings

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
