Skip to main content
Use configure() for HTTP API keys such as OpenAI, Stripe, and Resend. It automatically selects the right mode: proxy when your application runs through elding proxy, so the key never enters the application, and client otherwise, so the real key is retrieved from the vault. The same code works in development and production. For non-HTTP secrets such as database credentials or configuration, use secret().
import OpenAI from "openai";
import { configure } from "@elding/sdk";

const openai = new OpenAI(
  await configure("OPENAI_API_KEY", "https://api.openai.com")
);

What happens

Development (proxy)

apiKey receives a {{OPENAI_API_KEY}} placeholder. The real key remains in the proxy.

Production (serverless)

apiKey receives the real key, retrieved from the vault at startup.

Production

Add two environment variables to your deployment platform. The SDK reads them automatically: the code above does not change and no options are required.
ELDING_REFRESH_TOKEN=eld_rt_...   # dashboard → API Keys
ELDING_SET_ID=...                 # the ID of your set
During development, your AI agent never sees the key because the proxy holds it. In production, configure() automatically switches to client mode and retrieves the key from the vault. Write the code once. See Production for details.

The two modes

Proxy and client mode explained.