
# SAP AI Core Provider

[jerome-benoit/sap-ai-provider](https://github.com/jerome-benoit/sap-ai-provider) is a community provider for SAP AI Core built on the official **@sap-ai-sdk/orchestration** and **@sap-ai-sdk/foundation-models** packages.

Two npm packages are published from this repository:

- `@jerome-benoit/sap-ai-provider` - Language Model V4 for AI SDK 5.x & 6.x (recommended)
- `@jerome-benoit/sap-ai-provider-v2` - Language Model V2 for AI SDK 5.x

## Features

Both providers offer:

- **Dual API Support**: Choose between Orchestration API (with data masking, content filtering, document grounding, translation) or Foundation Models API (`logprobs`, `seed`, `dataSources`)
- **Tool calling** and **multi-modal input** (images)
- **Streaming support** for real-time text generation
- **Text embeddings** for RAG and semantic search

## Setup

### @jerome-benoit/sap-ai-provider (recommended)

<Tabs items={['pnpm', 'npm', 'yarn', 'bun']}>
  <Tab>
    <Snippet text="pnpm add @jerome-benoit/sap-ai-provider" dark />
  </Tab>
  <Tab>
    <Snippet text="npm install @jerome-benoit/sap-ai-provider" dark />
  </Tab>
  <Tab>
    <Snippet text="yarn add @jerome-benoit/sap-ai-provider" dark />
  </Tab>
  <Tab>
    <Snippet text="bun add @jerome-benoit/sap-ai-provider" dark />
  </Tab>
</Tabs>

### @jerome-benoit/sap-ai-provider-v2

<Tabs items={['pnpm', 'npm', 'yarn', 'bun']}>
  <Tab>
    <Snippet text="pnpm add @jerome-benoit/sap-ai-provider-v2" dark />
  </Tab>
  <Tab>
    <Snippet text="npm install @jerome-benoit/sap-ai-provider-v2" dark />
  </Tab>
  <Tab>
    <Snippet text="yarn add @jerome-benoit/sap-ai-provider-v2" dark />
  </Tab>
  <Tab>
    <Snippet text="bun add @jerome-benoit/sap-ai-provider-v2" dark />
  </Tab>
</Tabs>

Authentication is handled automatically via the `AICORE_SERVICE_KEY` environment variable (local) or `VCAP_SERVICES` (SAP BTP).

## Provider Instance

You can import the default provider instance `sapai` from `@jerome-benoit/sap-ai-provider`:

```ts
import { sapai } from '@jerome-benoit/sap-ai-provider';
```

If you need a customized setup, you can import `createSAPAIProvider` and create a provider instance with your settings:

```ts
import { createSAPAIProvider } from '@jerome-benoit/sap-ai-provider';

const sapai = createSAPAIProvider({
  resourceGroup: 'default',
  api: 'orchestration', // or 'foundation-models'
});
```

You can use the following optional settings to customize the SAP AI provider instance:

- **resourceGroup** _string_

  SAP AI Core resource group. Defaults to `'default'`.

- **deploymentId** _string_

  Specific deployment ID. If not provided, the SDK resolves deployment automatically.

- **api** _'orchestration' | 'foundation-models'_

  API to use. Defaults to `'orchestration'`. Can be overridden per model or per call via `providerOptions`.

- **name** _string_

  Provider name used as key in `providerOptions`. Defaults to `'sap-ai'`.

- **defaultSettings** _object_

  Default model settings including `modelParams`, `masking`, `filtering`, `grounding`, and `translation`.

## Language Models

You can create models that call the SAP AI Core API using the provider instance. The first argument is the model id. Model naming follows SAP AI Core conventions with vendor prefixes:

```ts
const model = sapai('gpt-4.1');
const claudeModel = sapai('anthropic--claude-3.5-sonnet');
const geminiModel = sapai('gemini-2.0-flash');
```

<Note>
  Model availability depends on your SAP AI Core tenant configuration and
  region.
</Note>

## Embedding Models

You can create models that call the SAP AI Core embeddings API using the `.embeddingModel()` factory method:

```ts
const model = sapai.embeddingModel('text-embedding-3-small');
```


## Navigation

- [Writing a Custom Provider](/v7/providers/community-providers/custom-providers)
- [A2A](/v7/providers/community-providers/a2a)
- [ACP (Agent Client Protocol)](/v7/providers/community-providers/acp)
- [Aihubmix](/v7/providers/community-providers/aihubmix)
- [AI/ML API](/v7/providers/community-providers/aimlapi)
- [Anthropic Vertex](/v7/providers/community-providers/anthropic-vertex-ai)
- [Automatic1111](/v7/providers/community-providers/automatic1111)
- [Azure AI](/v7/providers/community-providers/azure-ai)
- [Browser AI](/v7/providers/community-providers/browser-ai)
- [Claude Code](/v7/providers/community-providers/claude-code)
- [Cloudflare AI Gateway](/v7/providers/community-providers/cloudflare-ai-gateway)
- [Cloudflare Workers AI](/v7/providers/community-providers/cloudflare-workers-ai)
- [Codex CLI](/v7/providers/community-providers/codex-cli)
- [Crosshatch](/v7/providers/community-providers/crosshatch)
- [Dify](/v7/providers/community-providers/dify)
- [Firemoon](/v7/providers/community-providers/firemoon)
- [FriendliAI](/v7/providers/community-providers/friendliai)
- [Gemini CLI](/v7/providers/community-providers/gemini-cli)
- [Helicone](/v7/providers/community-providers/helicone)
- [Inflection AI](/v7/providers/community-providers/inflection-ai)
- [Jina AI](/v7/providers/community-providers/jina-ai)
- [LangDB](/v7/providers/community-providers/langdb)
- [Letta](/v7/providers/community-providers/letta)
- [llama.cpp](/v7/providers/community-providers/llama-cpp)
- [LlamaGate](/v7/providers/community-providers/llamagate)
- [MCP Sampling AI Provider](/v7/providers/community-providers/mcp-sampling)
- [Mem0](/v7/providers/community-providers/mem0)
- [MiniMax](/v7/providers/community-providers/minimax)
- [Mixedbread](/v7/providers/community-providers/mixedbread)
- [Ollama](/v7/providers/community-providers/ollama)
- [OpenCode](/v7/providers/community-providers/opencode-sdk)
- [OpenRouter](/v7/providers/community-providers/openrouter)
- [Portkey](/v7/providers/community-providers/portkey)
- [Qwen](/v7/providers/community-providers/qwen)
- [React Native Apple](/v7/providers/community-providers/react-native-apple)
- [Requesty](/v7/providers/community-providers/requesty)
- [Runpod](/v7/providers/community-providers/runpod)
- [SambaNova](/v7/providers/community-providers/sambanova)
- [SAP AI Core](/v7/providers/community-providers/sap-ai)
- [Sarvam](/v7/providers/community-providers/sarvam)
- [Soniox](/v7/providers/community-providers/soniox)
- [Spark](/v7/providers/community-providers/spark)
- [Supermemory](/v7/providers/community-providers/supermemory)
- [Voyage AI](/v7/providers/community-providers/voyage-ai)
- [Zhipu AI (Z.AI)](/v7/providers/community-providers/zhipu)
- [vectorstores](/v7/providers/community-providers/vectorstores)
- [Codex CLI (App Server)](/v7/providers/community-providers/codex-app-server)
- [Apertis](/v7/providers/community-providers/apertis)
- [OLLM](/v7/providers/community-providers/ollm)
- [Cencori](/v7/providers/community-providers/cencori)
- [Hindsight](/v7/providers/community-providers/hindsight)
- [ZeroEntropy](/v7/providers/community-providers/zeroentropy)
- [Flowise](/v7/providers/community-providers/flowise)


[Full Sitemap](/sitemap.md)
