[{"data":1,"prerenderedAt":533},["ShallowReactive",2],{"\u002Fdocs\u002Fopenai-api-key":3,"docs-nav":486},{"id":4,"title":5,"answer":6,"body":7,"brands":431,"date":438,"description":439,"extension":440,"faq":441,"keywords":457,"meta":462,"navigation":463,"order":420,"path":464,"product":465,"related":468,"seo":476,"stem":477,"steps":478,"updated":438,"__hash__":485},"docs\u002Fdocs\u002Fopenai-api-key.md","How to get an OpenAI API key","Sign in at platform.openai.com, add credit under Billing, then create a key on the API keys page and copy it straight away. OpenAI shows the full key only once.",{"type":8,"value":9,"toc":419},"minimark",[10,14,19,48,51,55,64,68,77,88,92,105,112,127,131,150,153,157,192,198,201,216,221,228,232,246,282,285,305,308,315,319,333,341,345,348,415],[11,12,13],"p",{},"Getting a key takes three things on OpenAI’s website: an account, some credit and the key itself. Then you paste it into WLN once.",[15,16,18],"h2",{"id":17},"before-you-start","Before you start",[20,21,22,38],"ul",{},[23,24,25,29,30,37],"li",{},[26,27,28],"strong",{},"The API isn’t part of ChatGPT."," A ChatGPT Plus or Pro plan doesn’t include API credit, and the two are billed separately (",[31,32,36],"a",{"href":33,"rel":34},"https:\u002F\u002Fhelp.openai.com\u002Fen\u002Farticles\u002F6950777-what-is-chatgpt-plus",[35],"nofollow","OpenAI help, checked 5 Dec 2026",").",[23,39,40,43,44,37],{},[26,41,42],{},"You pay before you use it."," API billing is prepaid. OpenAI lists the smallest purchase as $5, and bought credit expires after one year, or 180 days for credit bought in Japan from 13 November 2026 (",[31,45,36],{"href":46,"rel":47},"https:\u002F\u002Fhelp.openai.com\u002Fen\u002Farticles\u002F8264644-what-is-prepaid-billing",[35],[11,49,50],{},"OpenAI changes its dashboard now and then. If a button below has a new name, the linked help page will have the current one.",[15,52,54],{"id":53},"step-1-sign-in-to-the-openai-platform","Step 1: Sign in to the OpenAI platform",[11,56,57,58,63],{},"Go to ",[31,59,62],{"href":60,"rel":61},"https:\u002F\u002Fplatform.openai.com",[35],"platform.openai.com"," and sign in, or create an account. This is OpenAI’s site for developers, separate from the ChatGPT app.",[15,65,67],{"id":66},"step-2-add-credit","Step 2: Add credit",[11,69,70,71,76],{},"Open the billing page (",[31,72,75],{"href":73,"rel":74},"https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fbilling",[35],"platform.openai.com\u002Faccount\u002Fbilling",") and add credit to your balance.",[11,78,79,80,83,84,87],{},"During setup OpenAI turns on ",[26,81,82],{},"auto-reload",", which buys more credit when your balance runs low (",[31,85,36],{"href":46,"rel":86},[35],"). Leave it on if you don’t want replies to stop, or switch it off if you’d rather never be charged without deciding first.",[15,89,91],{"id":90},"step-3-create-the-key","Step 3: Create the key",[11,93,94,95,100,101,104],{},"Open the ",[31,96,99],{"href":97,"rel":98},"https:\u002F\u002Fplatform.openai.com\u002Fapi-keys",[35],"API keys page"," and choose ",[26,102,103],{},"Create new secret key",". Give it a name you’ll recognise later, such as “WLN on my MacBook”, and pick the project it belongs to.",[11,106,107,108,111],{},"Copy the key as soon as it appears. ",[26,109,110],{},"OpenAI shows the full key only once."," If you lose it, delete it and make a new one.",[11,113,114,115,120,121,126],{},"Sources, checked 5 Dec 2026: ",[31,116,119],{"href":117,"rel":118},"https:\u002F\u002Fhelp.openai.com\u002Fen\u002Farticles\u002F4936850-where-do-i-find-my-openai-api-key",[35],"where to find your API key"," and ",[31,122,125],{"href":123,"rel":124},"https:\u002F\u002Fhelp.openai.com\u002Fen\u002Farticles\u002F9186755-managing-your-work-in-the-api-platform-with-projects",[35],"keys in projects",".",[15,128,130],{"id":129},"step-4-set-a-spending-limit-at-openai","Step 4: Set a spending limit at OpenAI",[11,132,133,134,137,138,141,142,145,146,37],{},"In your organization settings, open the project and go to ",[26,135,136],{},"Limits",". There you can set a ",[26,139,140],{},"Monthly spend limit"," and turn on ",[26,143,144],{},"Enforce a hard limit",", which stops requests once the limit is reached. OpenAI notes the check isn’t instant, so spending can go slightly over. An alert only warns you. It doesn’t stop anything (",[31,147,149],{"href":123,"rel":148},[35],"OpenAI help on projects, checked 5 Dec 2026",[11,151,152],{},"We’d set a hard limit even if it’s a high one. If the key ever leaks, the damage has a ceiling.",[15,154,156],{"id":155},"step-5-put-the-key-in-wln","Step 5: Put the key in WLN",[158,159,160,171,178,185],"ol",{},[23,161,162,163,166,167,170],{},"In WLN, open ",[26,164,165],{},"Settings › Models and API key"," and find the ",[26,168,169],{},"OpenAI key"," section.",[23,172,173,174,177],{},"Paste the key and press ",[26,175,176],{},"Save",". WLN checks it with OpenAI and keeps it in Keychain on your Mac.",[23,179,180,181,184],{},"WLN asks “Send your chats to OpenAI?”. Press ",[26,182,183],{},"Allow",". No chat goes to OpenAI until you do.",[23,186,187,188,191],{},"When the line turns green and says “Saved. OpenAI models are ready.”, the key works. The ",[26,189,190],{},"Test"," button checks it again whenever you like.",[193,194],"doc-shot",{"alt":195,"caption":196,"name":197},"The OpenAI key section in WLN with the status Saved. OpenAI models are ready. The key is blurred.","A saved OpenAI key. We blurred the key in this screenshot.","docs-openai-key-saved",[11,199,200],{},"WLN can’t tell an OpenAI key from a SubQ key by its look, since they start the same way. So paste an OpenAI key into the OpenAI section.",[11,202,203,204,207,208,211,212,215],{},"Next, give an OpenAI model a job. In ",[26,205,206],{},"Settings › Models and API key › Team",", choose ",[26,209,210],{},"Custom",", set a role’s provider to ",[26,213,214],{},"OpenAI"," and pick a model. The menu shows each model’s price per million tokens. If OpenAI is your only key, do this for every role you use.",[193,217],{"alt":218,"caption":219,"name":220},"The Team section with the Custom preset and an OpenAI model on the Builder row.","Custom team with an OpenAI model as the Builder. Prices as listed on 5 December 2026.","docs-openai-team",[11,222,223,224,126],{},"WLN’s own limit works alongside OpenAI’s: every new chat stops at $5 unless you raise it. More in ",[31,225,227],{"href":226},"\u002Fdocs\u002Fget-started","Get started with WLN",[15,229,231],{"id":230},"using-the-key-in-your-own-scripts","Using the key in your own scripts",[11,233,234,235,239,240,245],{},"OpenAI suggests keeping the key in an environment variable called ",[236,237,238],"code",{},"OPENAI_API_KEY"," (",[31,241,244],{"href":242,"rel":243},"https:\u002F\u002Fhelp.openai.com\u002Fen\u002Farticles\u002F5112595-best-practices-for-api-key-safety",[35],"OpenAI, checked 5 Dec 2026","). On a Mac, you can add it to your shell settings. In Terminal, open the file:",[247,248,253],"pre",{"className":249,"code":250,"language":251,"meta":252,"style":252},"language-bash shiki shiki-themes github-light github-dark","touch ~\u002F.zshrc && open -e ~\u002F.zshrc\n","bash","",[236,254,255],{"__ignoreMap":252},[256,257,260,264,268,272,275,279],"span",{"class":258,"line":259},"line",1,[256,261,263],{"class":262},"sScJk","touch",[256,265,267],{"class":266},"sZZnC"," ~\u002F.zshrc",[256,269,271],{"class":270},"sVt8B"," && ",[256,273,274],{"class":262},"open",[256,276,278],{"class":277},"sj4cs"," -e",[256,280,281],{"class":266}," ~\u002F.zshrc\n",[11,283,284],{},"Add this line with your key in place of the placeholder, save, and open a new Terminal window:",[247,286,288],{"className":249,"code":287,"language":251,"meta":252,"style":252},"export OPENAI_API_KEY='paste-your-key-here'\n",[236,289,290],{"__ignoreMap":252},[256,291,292,296,299,302],{"class":258,"line":259},[256,293,295],{"class":294},"szBVR","export",[256,297,298],{"class":270}," OPENAI_API_KEY",[256,300,301],{"class":294},"=",[256,303,304],{"class":266},"'paste-your-key-here'\n",[11,306,307],{},"Pasting the key into the file, not into a Terminal command, keeps it out of your shell history.",[11,309,310,311,314],{},"That stores the key as plain text in ",[236,312,313],{},"~\u002F.zshrc",", so keep that file out of anything you share or back up to a public place. WLN doesn’t read this variable. It uses the copy you saved in Settings, which stays in Keychain.",[15,316,318],{"id":317},"keep-the-key-safe","Keep the key safe",[20,320,321,324,327,330],{},[23,322,323],{},"Never paste it into a chat, an email or a code repository.",[23,325,326],{},"Don’t put it in a website’s or a phone app’s code. Anyone who downloads them can read it.",[23,328,329],{},"Use one key per app or per Mac, so you can delete one without breaking the rest.",[23,331,332],{},"If a key leaks, delete it on the API keys page right away. A deleted key stops working.",[11,334,335,336,340],{},"OpenAI’s own list is on its ",[31,337,339],{"href":242,"rel":338},[35],"key safety page"," (checked 5 Dec 2026).",[15,342,344],{"id":343},"when-something-goes-wrong","When something goes wrong",[11,346,347],{},"These are the messages WLN shows for the usual OpenAI problems, and what to do about each.",[349,350,351,367],"table",{},[352,353,354],"thead",{},[355,356,357,361,364],"tr",{},[358,359,360],"th",{},"WLN says",[358,362,363],{},"What it means",[358,365,366],{},"What to do",[368,369,370,382,393,404],"tbody",{},[355,371,372,376,379],{},[373,374,375],"td",{},"OpenAI says it doesn’t recognise this API key.",[373,377,378],{},"The key is wrong, was deleted, or has a stray space.",[373,380,381],{},"Copy the key again, or make a new one and paste it in Settings.",[355,383,384,387,390],{},[373,385,386],{},"OpenAI says this account has no credit left or reached its spending limit.",[373,388,389],{},"The balance is empty, or a spend limit was reached.",[373,391,392],{},"Add credit or raise the limit on OpenAI’s site. Trying again won’t help until you do.",[355,394,395,398,401],{},[373,396,397],{},"OpenAI says too many requests were sent.",[373,399,400],{},"A rate limit: too much in a short time.",[373,402,403],{},"WLN waits and tries again by itself first. If it still fails, wait a moment.",[355,405,406,409,412],{},[373,407,408],{},"OpenAI says “model name” isn’t available to this account.",[373,410,411],{},"Your account can’t use that model yet.",[373,413,414],{},"Choose another model in Settings › Models and API key › Team.",[416,417,418],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}",{"title":252,"searchDepth":420,"depth":420,"links":421},2,[422,423,424,425,426,427,428,429,430],{"id":17,"depth":420,"text":18},{"id":53,"depth":420,"text":54},{"id":66,"depth":420,"text":67},{"id":90,"depth":420,"text":91},{"id":129,"depth":420,"text":130},{"id":155,"depth":420,"text":156},{"id":230,"depth":420,"text":231},{"id":317,"depth":420,"text":318},{"id":343,"depth":420,"text":344},[214,432,433,434,435,436,437],"ChatGPT","GPT","SubQ","OpenRouter","DeepSeek","GLM","2026-12-05","Create an OpenAI API key, add credit, set a spending limit and use the key in WLN or your own scripts. Steps checked against OpenAI’s help pages on 5 December 2026.","md",[442,445,448,451,454],{"q":443,"a":444},"Is the OpenAI API free?","\u003Cp>No, it’s pay as you go. You buy credit first, and each request is taken from it. OpenAI says the smallest purchase is $5 and that bought credit expires after a year (\u003Ca href=\"https:\u002F\u002Fhelp.openai.com\u002Fen\u002Farticles\u002F8264644-what-is-prepaid-billing\">checked 5 Dec 2026\u003C\u002Fa>). If your account has free credit, it’s used first.\u003C\u002Fp>",{"q":446,"a":447},"Does ChatGPT Plus include API access?","\u003Cp>No. ChatGPT plans and the API are billed separately, and a ChatGPT subscription doesn’t include API credit (\u003Ca href=\"https:\u002F\u002Fhelp.openai.com\u002Fen\u002Farticles\u002F6950777-what-is-chatgpt-plus\">OpenAI, checked 5 Dec 2026\u003C\u002Fa>).\u003C\u002Fp>",{"q":449,"a":450},"How much does a chat in WLN cost with my OpenAI key?","\u003Cp>It depends on the model and how long the chat gets. WLN shows the cost under every reply, and the model menu in Settings lists each model’s price per million tokens. Every new chat also has a $5 limit you can change. See \u003Ca href=\"\u002Fpricing\">Pricing\u003C\u002Fa>.\u003C\u002Fp>",{"q":452,"a":453},"Can I use the same key on two Macs?","\u003Cp>It works, but one key per Mac is better. If one Mac is lost or a key leaks, you delete that key and the other keeps working. OpenAI also asks that each person uses their own key (\u003Ca href=\"https:\u002F\u002Fhelp.openai.com\u002Fen\u002Farticles\u002F5112595-best-practices-for-api-key-safety\">OpenAI, checked 5 Dec 2026\u003C\u002Fa>).\u003C\u002Fp>",{"q":455,"a":456},"Where does WLN keep my OpenAI key?","\u003Cp>In Keychain on your Mac. WLN sends it only to OpenAI.\u003C\u002Fp>",[458,459,460,461],"get openai api key","openai get api key","openai generate api key","openai api key environment variable",{},true,"\u002Fdocs\u002Fopenai-api-key",{"to":466,"label":467},"\u002Fchatgpt-alternative-mac","Use your OpenAI key in WLN",[469,470,473],{"to":226,"label":227},{"to":471,"label":472},"\u002Fpricing","Pricing",{"to":474,"label":475},"\u002Fsupport","Support",{"title":5,"description":439},"docs\u002Fopenai-api-key",[479,480,481,482,483,484],"Sign in at platform.openai.com.","Add credit on the Billing page.","Open the API keys page and create a new secret key.","Copy the key right away and keep it somewhere safe.","Set a monthly spend limit for the project.","In WLN, paste the key in Settings › Models and API key › OpenAI key and press Save.","5_QiQZPfeiOLQFYFGr9VqqKD2R3RE3xHlJw0ZmgkYJI",[487,488,489,493,497,501,505,509,513,517,521,525,529],{"title":227,"path":226,"order":259},{"title":5,"path":464,"order":420},{"title":490,"path":491,"order":492},"How to get an Anthropic (Claude) API key","\u002Fdocs\u002Fanthropic-api-key",3,{"title":494,"path":495,"order":496},"How to get an OpenRouter API key","\u002Fdocs\u002Fopenrouter-api-key",4,{"title":498,"path":499,"order":500},"How to get a SubQ API key","\u002Fdocs\u002Fsubq-api-key",5,{"title":502,"path":503,"order":504},"What a chat costs, and how the $5 spending limit works","\u002Fdocs\u002Fcosts-and-spending-limit",6,{"title":506,"path":507,"order":508},"The coding team: Planner, Builder and Reviewer","\u002Fdocs\u002Fcoding-team",7,{"title":510,"path":511,"order":512},"Connectors (MCP servers) in WLN","\u002Fdocs\u002Fconnectors",8,{"title":514,"path":515,"order":516},"Skills and memories","\u002Fdocs\u002Fskills-and-memory",9,{"title":518,"path":519,"order":520},"Web search and the browser","\u002Fdocs\u002Fweb-search-and-browser",10,{"title":522,"path":523,"order":524},"Live preview: run your project and see artifacts","\u002Fdocs\u002Flive-preview",11,{"title":526,"path":527,"order":528},"Privacy: where WLN keeps your keys and chats","\u002Fdocs\u002Fprivacy",12,{"title":530,"path":531,"order":532},"Requirements, updates and troubleshooting","\u002Fdocs\u002Ftroubleshooting",13,1796476260095]