JavaScript SDK Overview
Quick Start
For a quick start, check out the Getting Started section.
Why the SAP Cloud SDK for AI (SAP AI SDK)?
The SAP Cloud SDK for AI (SAP AI SDK) enables developers to seamlessly integrate AI capabilities, such as chat completion, into their JavaScript / TypeScript-based business applications using SAP Generative AI Hub. Leverage powerful features like templating, grounding, data masking, and content filtering to build intelligent applications. The SAP Cloud SDK for AI simplifies the setup and interaction with SAP AI Core, allowing you to focus on delivering value through AI integration.
Feature Matrix
Below you can find an overview of the currently available features and documentation.
Legend: ✅ - Generally Available, ❌ - Not Available, 📅 - Planned, ➖- Not Applicable
Feature | Orchestration | Orchestration with LangChain | OpenAI | OpenAI with LangChain |
---|---|---|---|---|
Chat Completion | ✅ docs | ✅ docs | ✅ docs | ✅ docs |
Templates | ✅ docs | ❌ | ❌ | ➖ |
Content Moderation (Filtering) | ✅ docs | ✅ * | ➖ | ➖ |
Data Masking | ✅ docs | ✅ * | ➖ | ➖ |
Grounding | ✅ docs | ❌ | ❌ | ➖ |
Chat Memory / Message History | ✅ docs | ✅ * | ✅ docs | ➖ |
JSON Configuration | ✅ docs | ➖ | ➖ | ➖ |
Stream Chat Completion | ✅ docs | ✅ docs | ✅ docs | ✅ docs |
Multi-modal Messages | ✅ docs | ❌ | ❌ | ➖ |
Response Format | ✅ docs | ❌ | ✅ docs | ✅ docs |
Translation Service | ✅ docs | ❌ | ➖ | ➖ |
Chat Completion: Tool Call | ✅ docs | ✅ * | ✅ docs | ✅ * |
Embedding | ❌ | ❌ | ✅ docs | ✅ docs |
*: The LangChain clients conform to LangChain interface. Client options are a combination of LangChain options and original client configurations. Refer to the original client and LangChain documentation for more information. Additionally, refer to the sample code in our official GitHub repository for examples.
Prerequisites
To use the SAP Cloud SDK for AI in a JavaScript / TypeScript application, it is necessary to understand the technical prerequisites and required versions for common dependencies.
- A project using Node.js v20+ with native ESM support.
Node.js v20 is supported but approaching end-of-life (EOL).
➡️ We strongly recommend upgrading to Node.js v22 (Active LTS) or v24 (Current) for long-term support, security updates, and improved ESM/CommonJS interoperability.
If your project is still using CommonJS, you can consume ESM modules via:
- Dynamic
import()
(all versions) require()
(experimental, v20.19+)
- Access to an SAP AI Core Service instance. Refer to enable the AI Core service in SAP BTP.
- Ensure either an Orchestration or OpenAI model deployment is available.
- Alternatively, you can create a deployment using the SAP AI Launchpad.
- Once a deployment is complete, access the model via the
deploymentUrl
.
Refer to Connecting to AI Core section for how to connect the SAP Cloud SDK for AI to AI Core.
Availability of Generative AI Models
For a detailed list of available models, refer to the SAP note Availability of Generative AI Models.
Deprecated Models
The following models are deprecated in SAP Cloud SDK for AI and should not be used. Replace them with the recommended alternatives.
Model Name | Replacement |
---|---|
text-embedding-ada-002 | text-embedding-3-small , text-embedding-3-large |
gpt-35-turbo | gpt-4o-mini |
gpt-35-turbo-16k | gpt-4o-mini |
gpt-4-32k | gpt-4o |
gpt-4 | gpt-4o , gpt-4.1 |
gemini-1.0-pro | gemini-2.0-flash , gemini-2.0-flash-lite |
mistralai--mixtral-8x7b-instruct-v01 | mistralai--mistral-small-instruct |
meta--llama3-70b-instruct | |
meta--llama3.1-70b-instruct | |
amazon--titan-text-express | |
amazon--titan-text-lite |
Contribute, Support and Feedback
This project is open to feature requests/suggestions and bug reports via GitHub issues. Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines.
Security / Disclosure
If you find any bug that may be a security problem, please follow our instructions at in our security policy on how to report it. Please do not create GitHub issues for security-related doubts or problems.
Code of Conduct
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its Code of Conduct at all times.
Licensing
Copyright 2024 SAP SE or an SAP affiliate company and ai-sdk-js contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.