Your first AI request
with Outlet Direct
On this page
Build a small app that uses your own OpenAI API key. Send a prompt. See the reply. Keep the code.
Plain HTML and JavaScript. Outlet SDK 0.4.1. Node.js 22 or later.
Before you start
You need an OpenAI API key with access to gpt-5.5 and available API credit. Use your own API key for Direct. Never paste an admin key into this app.
Outlet Direct is free forever. OpenAI bills API usage separately from a ChatGPT plan.
Run the app on your computer
Unzip the download. Open a terminal in the outlet-direct-starter folder and run:
npm ci npm start
Open http://127.0.0.1:4185 in your browser. Keep the terminal open while you use the app.
Add your own API key
Paste your OpenAI API key into the app. Press Use API key. Outlet checks the format on your device. OpenAI checks access when you send a request.
const session = await Outlet.direct({
keys: { openai: userPastedKey },
});
Send a prompt and read the reply
Leave the short example prompt or write your own. Press Send to OpenAI. The reply appears beside the form, or below it on a phone.
The browser sends the request directly to OpenAI. The local server only serves the app files. Outlet receives no API key, prompt, or reply in Direct.
Make it yours
- app.js
- Connects the form to the Outlet SDK and displays the reply.
- client.js
- Sends the request to OpenAI's Responses API. Change the model and request settings here.
- index.html
- Holds the API key field, prompt, and reply area.
- style.css
- Controls the layout and appearance.
The starter keeps the Direct API key in memory. Forget it or reload to clear it. Forgetting does not revoke the API key at OpenAI or undo a request already sent.
Keep API keys out of source files, logs, and shared screenshots. This browser example is for each person's own API key. Keep company-owned API keys on your server.
If the reply does not arrive
- API key refused
- Check that you pasted a current OpenAI API key for Direct. Admin keys are not accepted.
- Access or balance
- Check the API key permissions, model access, API balance, and rate limits on the OpenAI website.
- Partial reply
- The example limits output to 128 tokens. Try a shorter prompt or change the request settings in client.js.
- Request timed out
- Check your OpenAI usage before sending again. The starter does not retry automatically.
Run npm test to check the SDK integration and request handling with simulated provider responses. The tests do not use an API key or make paid requests.
Need the Vault connection?
This starter uses Direct. In Vault, a person connects their account and approves a capped App key for your app. See Connect your AI for the account flow and the Vault quickstart for a registered app.
API reference: OpenAI text generation · gpt-5.5