The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
docs - add sap gen ai provider on LiteLLM (#17667)
Ishaan Jaff3a43042fad01
diff --git a/docs/my-website/docs/providers/sap.md b/docs/my-website/docs/providers/sap.mdnew file mode 100644index 00000000000..a9183b9c0df--- /dev/null+++ b/docs/my-website/docs/providers/sap.md@@ -0,0 +1,121 @@+import Tabs from '@theme/Tabs';+import TabItem from '@theme/TabItem';++# SAP Generative AI Hub++LiteLLM supports SAP Generative AI Hub's Orchestration Service.++| Property | Details |+|-------|-------|+| Description | SAP's Generative AI Hub provides access to foundation models through the AI Core orchestration service. |+| Provider Route on LiteLLM | `sap/` |+| Supported Endpoints | `/chat/completions` |+| API Reference | [SAP AI Core Documentation](https://help.sap.com/docs/sap-ai-core) |++## Authentication++SAP Generative AI Hub uses service key authentication. You can provide credentials via:++1. **Environment variable** - Set `AICORE_SERVICE_KEY` with your service key JSON+2. **Direct parameter** - Pass `api_key` with the service key JSON string++```python showLineNumbers title="Environment Variable"+import os+os.environ["AICORE_SERVICE_KEY"] = '{"clientid": "...", "clientsecret": "...", ...}'+```++## Usage - LiteLLM Python SDK++```python showLineNumbers title="SAP Chat Completion"+from litellm import completion+import os++os.environ["AICORE_SERVICE_KEY"] = '{"clientid": "...", "clientsecret": "...", ...}'++response = completion(+ model="sap/gpt-4",+ messages=[{"role": "user", "content": "Hello from LiteLLM"}]+)+print(response)+```++```python showLineNumbers title="SAP Chat Completion - Streaming"+from litellm import completion+import os++os.environ["AICORE_SERVICE_KEY"] = '{"clientid": "...", "clientsecret": "...", ...}'++response = completion(+ model="sap/gpt-4",+ messages=[{"role": "user", "content": "Hello from LiteLLM"}],+ stream=True+)++for chunk in response:+ print(chunk.choices[0].delta.content or "", end="")+```++## Usage - LiteLLM Proxy++Add to your LiteLLM Proxy config:++```yaml showLineNumbers title="config.yaml"+model_list:+ - model_name: sap-gpt4+ litellm_params:+ model: sap/gpt-4+ api_key: os.environ/AICORE_SERVICE_KEY+```++Start the proxy:++```bash showLineNumbers title="Start Proxy"+litellm --config config.yaml+```++<Tabs>+<TabItem value="curl" label="cURL">++```bash showLineNumbers title="Test Request"+curl http://localhost:4000/v1/chat/completions \+ -H "Content-Type: application/json" \+ -H "Authorization: Bearer your-proxy-api-key" \+ -d '{+ "model": "sap-gpt4",+ "messages": [{"role": "user", "content": "Hello"}]+ }'+```++</TabItem>+<TabItem value="openai-sdk" label="OpenAI SDK">++```python showLineNumbers title="OpenAI SDK"+from openai import OpenAI++client = OpenAI(+ base_url="http://localhost:4000",+ api_key="your-proxy-api-key"+)++response = client.chat.completions.create(+ model="sap-gpt4",+ messages=[{"role": "user", "content": "Hello"}]+)+print(response.choices[0].message.content)+```++</TabItem>+</Tabs>++## Supported Parameters++| Parameter | Description |+|-----------|-------------|+| `temperature` | Controls randomness |+| `max_tokens` | Maximum tokens in response |+| `top_p` | Nucleus sampling |+| `tools` | Function calling tools |+| `tool_choice` | Tool selection behavior |+| `response_format` | Output format (json_object, json_schema) |+| `stream` | Enable streaming |+diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.jsindex 93d8a43578d..583722a9393 100644--- a/docs/my-website/sidebars.js+++ b/docs/my-website/sidebars.js@@ -668,6 +668,7 @@ const sidebars = {]},"providers/sambanova",+ "providers/sap","providers/snowflake","providers/togetherai","providers/topaz",diff --git a/litellm/proxy/public_endpoints/provider_create_fields.json b/litellm/proxy/public_endpoints/provider_create_fields.jsonindex ddd41ca0b1d..629760a7dd2 100644--- a/litellm/proxy/public_endpoints/provider_create_fields.json+++ b/litellm/proxy/public_endpoints/provider_create_fields.json@@ -2446,6 +2446,24 @@],"default_model_placeholder": "gpt-3.5-turbo"},+ {+ "provider": "SAP",+ "provider_display_name": "SAP Generative AI Hub",+ "litellm_provider": "sap",+ "credential_fields": [+ {+ "key": "api_key",+ "label": "SAP AI Core Service Key (JSON)",+ "placeholder": null,+ "tooltip": "Paste your SAP AI Core service key JSON. Contains clientid, clientsecret, and service URLs.",+ "required": true,+ "field_type": "textarea",+ "options": null,+ "default_value": null+ }+ ],+ "default_model_placeholder": "sap/gpt-4"+ },{"provider": "Snowflake","provider_display_name": "Snowflake",diff --git a/provider_endpoints_support.json b/provider_endpoints_support.jsonindex a0e794ce59d..37c2ec17371 100644--- a/provider_endpoints_support.json+++ b/provider_endpoints_support.json@@ -1554,6 +1554,23 @@"a2a": true}},+ "sap": {+ "display_name": "SAP Generative AI Hub (`sap`)",+ "url": "https://docs.litellm.ai/docs/providers/sap",+ "endpoints": {+ "chat_completions": true,+ "messages": true,+ "responses": true,+ "embeddings": false,+ "image_generations": false,+ "audio_transcriptions": false,+ "audio_speech": false,+ "moderations": false,+ "batches": false,+ "rerank": false,+ "a2a": true+ }+ },"snowflake": {"display_name": "Snowflake (`snowflake`)","url": "https://docs.litellm.ai/docs/providers/snowflake",