Skip to content

Boat.AI Proxy reference

Source: packages/boat/src/AiProxy.ts

The AI credentials proxy switch of a Boat account.

With the proxy on, a sandbox gets placeholders in place of the keys of its credential profile, and the proxy’s URL in place of each base URL. Boat swaps in the real key as a request passes through, so the key never enters the sandbox, and a copied placeholder stops working when the sandbox stops.

The switch is yours, or an organization’s. With an org on the stack (Boat.providers({ org }), or the profile’s) it is the organization’s, which only an owner can change. That is the same account that owns the stack’s Boat.CredentialProfiles.

The switch always exists, so nothing is created or deleted. Destroying the resource puts the switch back the way it was found.

export const MyProfile = Boat.CredentialProfile("MyProfile", {
anthropic: Config.Redacted("ANTHROPIC_API_KEY"),
});
export const Proxy = Boat.AiProxy("Proxy", { enabled: true });
export const Tenants = Boat.Environment("Tenants", {
safeForThirdParties: true,
credentialProfile: MyProfile,
proxyAiCredentials: Proxy,
});

proxyAiCredentials takes the proxy itself, so the environment is updated after the switch, and proxies only while it is on. Boat rejects proxyAiCredentials: true while the proxy is off.

export const Proxy = Boat.AiProxy("Proxy", { enabled: false });