SampleSampletypeA worked example you read or clone. Evidence: it demonstrates, it never provides.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →Reference

cap-openai

Two actions on one CAP service that reach OpenAI's chat completions endpoint by two routes: the openai npm client with the key from the environment, and a CAP remote service of kind: rest that goes through a destination in production.

chat_sdk builds new OpenAI({ apiKey: process.env['OPENAI_API_KEY'] }) and calls openai.chat.completions.create against gpt-4o. chat_api connects to OpenAI.Chat.Completion.API, which cds.requires declares as kind: rest with the url https://api.openai.com and the path /v1, replaced in [production] by credentials.destination: 'openai', then sends a POST to /chat/completions. The key stays in OPENAI_API_KEY on both routes, pushed by a set-env script that calls cf set-env and restages, so the SAP Destination service carries the address while the code still builds the Authorization header itself. There is no model and no app folder: one .cds file with the two actions, one handler, and a test/test.http to call them.

Facts

Last push

Where it sits

Lives in
Demonstrates
LLM integrationCAPLLM integrationcapabilityCalling a language model from application code with the tenant, destination and credential handling already solved instead using an SDK call with a hand-rolled key.Service integrationCAPService integrationcapabilityUsing a service that runs somewhere else as if it were one of your own: its API imported into the model, a proxy that turns a local query into the remote protocol, and a mock that stands in for it on a laptop. Distinct from [destinations](capability:destinations), which is how the address and the credentials are found, and from [replication](capability:replication), which is holding the data locally.DestinationsCAPDestinationscapabilityReaching a system that is not yours — an S/4HANA tenant, an on-premise service, a third-party API — without the address, the credentials or the tunnel being written into the application. The destination is the indirection, and the reason an endpoint can move without a redeploy.
Flavors
Node.jsfrom its runtime
Runs
Cloud Foundry
Requires
SAP Destination serviceSAP Destination serviceartifactThe production profile replaces the OpenAI url with a destination named openai, so once deployed the address comes from the destination rather than from the configuration.

Who is behind it

Mio YasutakeMio YasutakePersonMaintains this
In the atlas: maintains 47, contributes to 47, wrote 10
@miyasuta
maintainer

Before choosing this

Signals

LicenceNo licenseNeither the package manifest nor the repository tree declares a licence

Without a licence the default is all rights reserved. Ask the maintainer, or check for terms stated elsewhere, before depending on it.

What it declares

Every artifact

Type
Sample
Origin
Independently maintained
Use as
A reference
Runtime
Node.js
Runs on
Cloud Foundry

As a sample

Form
does not say

Connections4

README

quoted from miyasuta/cap-openai, read
miyasuta/cap-openai/README.mdOn GitHub

Getting Started

Welcome to your new project.

It contains these folders and files, following our recommended project layout:

File or FolderPurpose
app/content for UI frontends goes here
db/your domain models and data go here
srv/your service models and code go here
package.jsonproject metadata and configuration
readme.mdthis getting started guide
excerpt, no licence read, read the rest, on GitHub

Details

Sources3
GitHub APIdiscovered here, miyasutachecked
github.com/miyasuta/cap-openaitree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
runtimesnode
deploymentCloud Foundry
discovered viaGitHub API · miyasuta
first seen in the atlas
ecosystem and domaincap, ai-and-agents
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:miyasuta-cap-openai
JSON
/artifacts/miyasuta-cap-openai.json
MCP
Connecting an agent