SAP AI SDK for JavaScript - v2.15.0
    Preparing search index...

    Class SapOpenAiExperimental

    A pre-configured client for SAP AI Core backed by the official openai package. Handles deployment resolution, authentication, and SAP-specific headers automatically.

    The model parameter is removed from chat.completions.create(), chat.completions.parse(), embeddings.create(), and responses.create() signatures — SAP AI Core routes requests via the deployment URL, so the model field in the request body is not used.

    Only the endpoints supported by SAP AI Core are exposed (chat, embeddings, responses). Use SapOpenAi.createClient to create an instance. This class is experimental and may change at any time without prior notice.

    Index
    chat: SapChat
    embeddings: SapEmbeddings
    responses: SapResponses
    • Experimental

      Creates a pre-configured SapOpenAi client for SAP AI Core. Resolves the deployment and sets up authentication automatically. The model parameter is omitted from chat.completions.create(), chat.completions.parse(), embeddings.create(), and responses.create() — SAP AI Core routes requests via the deployment URL.

      Parameters

      • options: SapOpenAiInput

        Options including model deployment, destination, API version, and client type. A plain model name string is accepted as shorthand for { deployment: modelName }.

      Returns Promise<SapOpenAi>

      A promise that resolves to a ready-to-use SapOpenAi instance.

      import { SapOpenAi } from '@sap-ai-sdk/openai';

      const client = await SapOpenAi.createClient('gpt-5.4');
      await client.chat.completions.create({
      messages: [{ role: 'user', content: 'Hello!' }]
      });