Skip to content

feat: Add SAP AI Core provider support#5022

Closed
jerome-benoit wants to merge 1 commit into
anomalyco:devfrom
jerome-benoit:feat/add-sap-ai-core-provider
Closed

feat: Add SAP AI Core provider support#5022
jerome-benoit wants to merge 1 commit into
anomalyco:devfrom
jerome-benoit:feat/add-sap-ai-core-provider

Conversation

@jerome-benoit

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for SAP AI Core as a provider in OpenCode, enabling users to access 40+ AI models (GPT-4o, Claude, Gemini, Amazon Nova, etc.) through SAP Business Technology Platform.

Implementation Details

Provider Integration

  • Uses @mymediset/sap-ai-provider (community Vercel AI SDK compatible package)
  • Custom async loader pattern to handle OAuth2 authentication
  • Follows existing OpenCode provider architecture patterns

Configuration

Users can configure SAP AI Core via:

  1. Service Key: SAP_AI_SERVICE_KEY (JSON from SAP BTP Cockpit)
  2. Deployment ID: SAP_AI_DEPLOYMENT_ID (default: d65d81e7c077e583)
  3. Resource Group: SAP_AI_RESOURCE_GROUP (default: default)
  4. Auth Storage: opencode auth add sap-ai-core

Features Supported

  • ✅ OAuth2 authentication with automatic token refresh
  • ✅ 40+ models (OpenAI, Anthropic, Google, Amazon, Meta, Mistral, etc.)
  • ✅ Streaming responses
  • ✅ Tool calling (function calling)
  • ✅ Multi-modal inputs (text + images)
  • ✅ Structured outputs
  • ✅ Model parameters (temperature, topP, maxTokens, etc.)
  • ✅ Data masking via SAP Data Privacy Integration (DPI)

Files Changed

  • packages/opencode/package.json - Added @mymediset/sap-ai-provider@1.3.1
  • packages/opencode/src/provider/provider.ts - Added custom loader for SAP AI Core
  • packages/web/src/content/docs/providers.mdx - Added documentation
  • bun.lock - Updated dependencies

Testing Status

  • ✅ TypeScript compilation passes
  • ✅ Build succeeds (all platforms)
  • ⏳ Manual testing with real SAP AI Core instance (requires maintainer validation)

Documentation

Complete user-facing documentation added to providers.mdx including:

  • Prerequisites (SAP BTP subscription)
  • Service key acquisition steps
  • Configuration examples
  • Supported models list
  • Model parameters guide

Conformity with OpenCode Standards

  • ✅ Follows existing provider architecture (custom loader pattern like github-copilot)
  • ✅ Uses Auth.get() for credential management
  • ✅ Type-safe implementation with proper TypeScript types
  • ✅ Documentation follows exact formatting of existing providers
  • ✅ No style guideline violations

Why This Provider?

SAP AI Core is an enterprise-grade AI platform widely used in SAP ecosystem and beyond. This integration allows:

  • Enterprise users to leverage their existing SAP BTP infrastructure
  • Access to RAG (Retrieval-Augmented Generation) deployments
  • Enterprise compliance (data masking, audit trails)
  • Unified model access across OpenAI, Anthropic, Google, Amazon models

Questions for Maintainers

  1. Should we create a GitHub issue first per CONTRIBUTING.md guidelines?
  2. Any preferred approach for testing without exposing SAP credentials?
  3. Is the default deployment ID acceptable or should we require explicit configuration?

Note: This PR is in draft status to allow for review and validation before final testing.

Add integration for SAP AI Core using @mymediset/sap-ai-provider, enabling access to 40+ AI models (GPT-4o, Claude, Gemini, Amazon Nova, etc.) through SAP BTP.

Features:
- OAuth2 authentication with service key
- Support for 40+ models via SAP AI Core Orchestration API
- Configurable deployment ID and resource group
- Full Vercel AI SDK compatibility (streaming, tools, multi-modal)
- Environment variable configuration support

Configuration:
- SAP_AI_SERVICE_KEY: Service key from SAP BTP Cockpit
- SAP_AI_DEPLOYMENT_ID: Optional custom deployment (default: d65d81e7c077e583)
- SAP_AI_RESOURCE_GROUP: Optional resource group (default: default)

Documentation added to providers.mdx with setup instructions.
@jerome-benoit

Copy link
Copy Markdown
Contributor Author

Closing to recreate with simpler description per guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant