18.9.2.1 Creating Generative AI Service Objects
Learn how to create Generative AI Service objects.
- About AI Providers
Learn about supported AI providers in APEX. - Overview of Creating a Generative AI Service
Learn about key steps in creating Generative AI Service in APEX. - Creating a Generative AI Service
Learn about creating a Generative AI Service.
Parent topic: Managing Generative AI Services
18.9.2.1.1 About AI Providers
Learn about supported AI providers in APEX.
About Choosing an AI Provider
When choosing an AI provider, consider the following:
- Pick the right model for the right job. Different models excel at different tasks such as reasoning, speed, or quality. APEX lets you choose the model and provider that best fits your applications in terms of reasoning, performance and quality, and cost.
- Future-proof the platform. New AI models appear frequently. The best option today may not be the right choice tomorrow. With APEX, changing to a new AI provider or model is just a configuration change. Your application keeps working. To make a change, just point to better services or models.
- Local and hybrid deployment options. Support for local LLM frameworks, such as Ollama, means models can run inside customer controlled infrastructure for sensitive workloads or offline scenarios, while retaining the same APEX “remote server + credential” model. This is a practical approach in high-security deployments.
- Enterprise ready, security and governance. APEX executes AI calls server-side, stores secrets in the Web Credentials repository (so secrets are never exposed to client code), and works with network ACLs and enterprise governance.
Supported AI Providers
APEX supports the following AI providers:
- OpenAI - Uses
/chat/completionsfor chat and/embeddingsfor vector generation. OpenAI expects JSONwith messages[]and model parameters, and authenticates using a Bearer token. APEX maps its internal format to the OpenAI schema, injects credentials, and normalizes responses so applications see a consistent structure across models and providers. - Cohere - Uses /
chatfor chat and/embedfor embeddings. Cohere expects JSON payloads with messages or input text and authenticates using a Bearer token. APEX maps its normalized request model to Cohere's format, supports common parameters, and parses responses into a consistent structure independent of provider-specific fields. - OCI Generative AI - OCI Generative AI is a
fully managed Oracle Cloud Infrastructure service for building, deploying, and
operating generative AI applications at enterprise scale. OCI Generative AI
supports these core generative AI use cases:
- Chat for conversational experiences such as question answering and virtual assistants
- Embeddings for semantic search, recommendation, classification, and clustering
To learn more, see Oracle Cloud Infrastructure Documentation
- Google Gemini - Uses
generateContentfor chat andembedContentfor embeddings. Gemini expects structured JSON (withcontents[] / parts[]) and an API key passed as a URL query parameter. APEX injects the API key and constructs the Gemini payload automatically. Developers only choose the model. - Anthropic Claude - Exposes a messages-based API and
authenticates using an
x-api-keyheader. APEX maps Claude’s message/role structure into its internal format, calls the messages endpoint, and normalizes the returned content[] so your app receives a consistent response shape regardless of Claude model version. - Mistral AI - Follows an OpenAI-like API but exposes additional parameters and separate endpoints for chat and embeddings. APEX accepts those options and maps them into the normalized request model so applications behave the same whether they talk to Mistral or another supported provider.
- Ollama (local LLM execution) - Runs models locally and
exposes
/api/chatfor chat and/api/embedfor embeddings. APEX treats Ollama like any other provider, the service is registered the same way and the same normalization applies which lets organizations run inference entirely inside their infrastructure without changing application code. - Generic OpenAI-compatible endpoints - APEX supports a generic OpenAI-compatible path so any provider, proxy or self-hosted model that follows the OpenAI API spec (including fine-tuned or open-weight deployments) can be used with minimal or no custom work. If it speaks the OpenAI format, APEX can plug it into the same runtime surface.
APEX models each provider as a metadata driven service, transforms APEX’s internal request format into the provider’s expected payload, injects credentials safely on the server, executes the call, and parses the provider response back into a normalized result for the application. This is implemented by the provider normalization layer and the builder’s declarative pages.
Parent topic: Creating Generative AI Service Objects
18.9.2.1.2 Overview of Creating a Generative AI Service
Learn about key steps in creating Generative AI Service in APEX.
Creating an AI Service in APEX involves the following steps:
-
Navigate to the Generative AI Services page
In App Builder, select Workspace Utilties and then Generative AI. On the Generative AI Services page, create a new Generative AI Service.
-
Specify an Identity and Define Routing
Give the service a name, choose the provider type from the list, and enter the provider’s base URL (that is, the endpoint APEX will call). You can also give the service a static identifier that can be referenced programmatically.
-
Specify Credentials
Select or create a Web Credential to authenticate to the provider. Keys and secrets are stored securely in APEX’s credential repository so they are never exposed to application code or the browser.
-
Select a Model
Pick the model to use (for example,
claude-sonnet-4-6orgemini-3.1-pro-preview). APEX uses the selected model name when it builds the provider specific API request. -
Specify App Builder Integration and Defaults
Control whether the service is available to App Builder features (such as AI Assistant, Create Page from Natural Language and so on). You can optionally mark it as the default for new applications in the workspace.
-
Configure Runtime Controls
Configure operational settings such as Maximum AI Tokens and Server Timeout value so long-running calls are handled predictably.
-
Save
Once saved, every AI-powered component in the application routes through that service automatically. Swapping providers later is a single configuration update. Applications do not need code changes.
What Happens When an App Makes an AI Call
Every AI request in an APEX application follows the same path at runtime.
- An APEX component or PL/SQL API initiates the request.
- APEX looks up the configured provider, endpoint, and credential for the Generative AI Service.
- A provider-specific REST payload is assembled automatically.
- The request is sent through APEX's server-side REST infrastructure.
- The provider's response is parsed and normalized into a consistent APEX format.
- That normalized response is returned to the application.
Parent topic: Creating Generative AI Service Objects
18.9.2.1.3 Creating a Generative AI Service
Learn about creating a Generative AI Service.
Note:
Before creating a Generative AI Service, you need an API key or credentials from your AI Provider. To learn more, contact your AI Provider.Each AI Service must have a unique Name and Static ID within the workspace. To create a Generative AI Service, you select an AI Provider and then confirgure the attributes. Note that the specific steps and available attributes that display may differ depending upon AI Provider you select.
To create a Generative AI Service object:
Parent topic: Creating Generative AI Service Objects