SAP Cloud SDK for AI (Python)
Package rename: The PyPI package
generative-ai-hub-sdkis deprecated (v4.12.4 is the last release). Its successor issap-ai-sdk-gen(currently v6.10.0 per public PyPI registry evidence from 2026-06-15). Code and tutorials referencinggenerative-ai-hub-sdkshould migrate tosap-ai-sdk-gen; the import name remainsgen_ai_hub.
The official Python SDK for SAP Generative AI Hub and Orchestration Service. It wraps the native SDKs of model providers (OpenAI, Amazon Bedrock, Google GenAI) and offers a harmonised LangChain integration and a full Orchestration client — all routed through SAP AI Core with unified authentication. Package freshness is registry-verified; AI Core runtime behavior and exact model availability still require target-tenant validation.
Related Skills
- sap-ai-core: Platform setup, deployments, resource groups, and model management in SAP AI Core
- sap-cloud-sdk-ai: JavaScript/TypeScript and Java equivalents of this SDK
- sap-hana-ml: HANA-side machine learning in Python
- sap-dependency-security: Pip dependency hygiene and upgrade patterns
Related external skills
If your task involves working inside Databricks (notebooks, Unity Catalog, Spark, SAP Databricks in SAP Business Data Cloud), consider installing the Databricks agent skills plugin. Ask whether you would like help installing it — never install unprompted.
When to Use This Skill
Use this skill when:
- Building Python applications that call LLMs through SAP AI Core / Generative AI Hub
- Using the
gen_ai_hubPython package (installed assap-ai-sdk-gen) - Integrating OpenAI, Amazon Bedrock, or Google GenAI models via SAP's proxy
- Implementing LangChain chains with SAP AI Core as the backend
- Using the Orchestration Service from Python (templating, filtering, masking, grounding)
- Migrating code from the deprecated
generative-ai-hub-sdktosap-ai-sdk-gen - Generating embeddings through SAP AI Core
- Working with SAP RPT-1 (Relational Pretrained Transformer) for tabular predictions
Table of Contents
- Quick Start
- Installation
- Authentication
- Available Modules
- Supported Models
- Core Features
- Bundled Resources
Quick Start
Native OpenAI Chat Completion
Orchestration Service
Installation
Authentication
The SDK reads credentials via AICoreV2Client.from_env(), which resolves
credentials in this order:
- Keyword arguments passed to
GenAIHubProxyClient(...) - Environment variables —
AICORE_CLIENT_ID,AICORE_CLIENT_SECRET,AICORE_AUTH_URL,AICORE_BASE_URL,AICORE_RESOURCE_GROUP - Config file —
$AICORE_HOME/config.json(or path set byAICORE_CONFIG); useAICORE_PROFILEto select a named profile - VCAP_SERVICES — automatic on Cloud Foundry/Kyma when the AI Core service is bound
Local Development (Environment Variables)
Config File Profile
For detailed auth setup and troubleshooting, see references/getting-started-auth.md.
Available Modules
Native Clients by Provider
Supported Models
The Generative AI Hub catalog includes models from multiple providers. Check SAP's model catalog and the target tenant catalog for the authoritative model IDs. Example families:
Core Features
Chat Completion with OpenAI Client
Streaming
Embeddings
LangChain Integration
Content Filtering (via Orchestration)
Data Masking (via Orchestration)
Document Grounding (via Orchestration)
Common Errors
Bundled Resources
Reference Documentation
references/getting-started-auth.md- Installation, authentication, and config setupreferences/native-clients-guide.md- Native client usage for OpenAI, Amazon, Google, and SAP RPT-1references/orchestration-guide.md- Orchestration service: templating, filtering, masking, grounding, embeddingsreferences/langchain-guide.md- LangChain integration: LLM/embedding init, chains, structured outputsreferences/troubleshooting.md- Common errors, version compatibility, migration fromgenerative-ai-hub-sdk
Documentation Sources
Keep this skill updated using these sources:
- PyPI: https://pypi.org/pypi/sap-ai-sdk-gen/json — package metadata and README
- SDK Reference: https://help.sap.com/doc/generative-ai-hub-sdk/CLOUD/en-US/_reference/gen_ai_hub.html
- SAP Samples: https://github.com/SAP-samples/btp-gen-ai-hub-sdk-samples
- AI Core Help: https://help.sap.com/docs/sap-ai-core
- Deprecated Package: https://pypi.org/pypi/generative-ai-hub-sdk/json (for migration notes)


