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 serviceSAP Destination serviceNamed, credentialed addresses of other systems, resolved at runtime — so an application holds no URL and no secret of its own, and the same code reaches a different system in every landscape.sap official, btp 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
Where it sits
Who is behind it
In the atlas: maintains 47, contributes to 47, wrote 10@miyasutamaintainer
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
Connections
Reaching remote systems without addresses or credentials in the code
Calling a language model with tenant and credential handling solved
Using a remote service as if it were one of your own
Named, credentialed addresses of other systems resolved at runtime
Download
README
quoted from miyasuta/cap-openai, readGetting Started
Welcome to your new project.
It contains these folders and files, following our recommended project layout:
| File or Folder | Purpose |
|---|---|
app/ | content for UI frontends goes here |
db/ | your domain models and data go here |
srv/ | your service models and code go here |
package.json | project metadata and configuration |
readme.md | this getting started guide |
Details
Sources
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
History in the atlas
- First seen.
For your agent
- Ref
artifact:miyasuta-cap-openai- JSON
- /artifacts/miyasuta-cap-openai.json
- MCP
- Connecting an agent