fline

Is it safe to give Claude Code your API keys?

Claude Code needs to know your app uses a key, not the key itself. It can read the chat and your project folder, so keep live keys out of both and type them on your host's private page.

Free during the private beta. No card. We open accounts by hand, a few at a time.

By Vladislav Razin · Last checked 17 October 2026

Is it safe to give Claude Code your API keys? It depends on where the key ends up. Claude Code can read what you paste into the chat and the files in your project folder, so a key in either place is one it can see. The careful habit is to keep live keys out of both and type them only on your host's private page for keys. I build fline, hosting for apps made with Claude Code, so I have a stake in this question.

What can Claude Code see?

Claude Code can see anything you paste into the chat, and by default it can read the files in your project folder without asking you first. Anthropic's guide to Claude Code permissions lists reading files as something that needs no approval inside the folder you're working in.

So a key you paste into the chat is part of the conversation, and a key saved in a settings file in your project, often named .env, can be read whenever Claude Code works in that folder.

The same guide shows a setting that tells Claude Code's file tools to stay out of a file you name. It's worth using, but it doesn't cover every way a file can be read, so keeping live keys out of the folder is simpler.

Where should your app's API keys go?

A live key belongs on your host's private page for keys. An API key is a password your app uses to talk to another service, like payments or email. Whoever holds it can use that service as you, and the bill comes to you. The four places a key can sit:

  • In the chat. Claude Code sees it. Avoid this for any key that can spend money or reach customer information.
  • In a file in your project. Claude Code can read it, and the key travels with the folder wherever it's copied or sent. On your computer, use a test key when the service offers one.
  • In the code that runs in the visitor's browser. Anyone who opens your app can find it there. Some keys are made to be public, but a secret key never belongs here.
  • On your host's private page. You type it in your browser, the host stores it, and your app gets it while it runs.

How do you hide API keys from Claude Code?

You hide a key from Claude Code by keeping it out of the chat and the folder, and by telling Claude Code that's the rule. It needs the key's name and what it's for, not the value.

Paste this into Claude Code
Don't ask me to paste keys into the chat. When my app needs a key, tell me its name and where I get it, and I'll type it on my host's private page.

To find keys already in your files, and check the browser side too:

Paste this into Claude Code
Tell me which files in my project hold keys or passwords, and make sure no secret key ends up in the code that runs in the visitor's browser.

What if Claude Code already has your key?

If a live key has been in the chat or in a file Claude Code read, replace it, especially a key that can spend money or reach your customers' information.

  1. Go to the service that issued the key, like your payment or email company, and get a new one. Most services let you cancel the old key in the same place.
  2. Type the new key on your host's private page, not in the chat.
  3. If your app is already online, restart it there so it uses the new key.

Nothing bad has to have happened. It just means the old key stops working, wherever it has been.

How fline handles your keys

On fline, when your app needs a password or key, Claude Code gives you a link to a private fline page, and you type the key there in your browser.

  • The page works once, for 10 minutes, and only while you're signed in to your own fline account. If it expires, Claude Code can make a new link without seeing any value.
  • Claude Code sees that you entered the key, not what you typed.
  • Once a key is saved, nothing in fline shows it again, not to Claude Code and not on your dashboard.
  • If your app prints a saved key word for word, fline blanks it out of what you and Claude Code see. A changed or partial copy gets through.
  • To work out how to build and run your app, fline sends parts of your code to an AI model made by OpenAI. Keys you save on fline never go to that model or into the build. Files named like key files, and files holding a few common kinds of key, are kept away from that model, and fline tells Claude Code which file it found. They still go into your app's build, so ask Claude Code to leave them out of what it sends. fline can't catch every key.

One thing to know: if Claude Code already holds a key, from the chat or a file, it can save that key on fline itself, and it can't read it back. If you pasted the key into the chat, Claude Code should then suggest you replace it with a new key on the private page.

To replace a key, choose Replace next to its name on your fline dashboard, then ask Claude Code to restart your app. The full guide to passwords and keys on fline has every step. A database you already run gets its address typed on a private fline page too. See whether your app needs a database.

Where fline fits

fline is hosting for apps you build with Claude Code on your own computer. You connect Claude Code to fline and ask it to put your project online. fline works out how to build and run it, your app gets a link you can send, and your keys go on the private page described above. How to put your Claude Code app online walks through it.

Paste this into Claude Code
Put this project online with fline.

fline takes care of where your keys live. It doesn't check what your app's own code does with them, so ask Claude Code to look before you share your link. fline is in private beta. Today it puts online a project that is a folder on your computer, and Claude Code is tested with it from start to finish. We open accounts by hand, a few at a time, and it's free during the private beta, with no card. The facts page lists what fline does today and what it doesn't do yet.

If that sounds like you, ask for early access.

Questions people ask

Can Claude Code see my API keys?

Claude Code can see a key you paste into the chat, and by default it can read the files in your project folder without asking, so a key saved there is open to it too. On fline, you type a key on a private page: Claude Code sees that you entered it, not what you typed, and nothing in fline shows a saved key again.

Should I give AI my API keys?

Give it the key's name and job, not the key itself. Claude Code needs to know your app uses a payment or email key so it can write the code that reads it. It doesn't need the value. Type the live key on your host's private page, and replace any key you already pasted into a chat.

How do I hide API keys from Claude Code?

Keep live keys out of the chat and out of your project folder. Type them on your host's private page, use a test key on your computer when the service offers one, and ask Claude Code which files hold keys so you can move them. Anthropic also documents a setting that stops Claude Code's file tools from reading files you name.

Where do I put the API key in Claude Code?

It depends on which key. To use Claude Code itself, you usually sign in with your Claude account in a browser window it opens the first time you start it. Anthropic's sign-in guide covers other ways, including an API key. A key your app uses, like a payment or email key, doesn't go into Claude Code at all. It goes on your host's private page.

What if I already pasted a key into the chat?

Replace it, especially if it can spend money or reach your customers' information. Get a new key from the service that issued it, cancel the old one, and type the new key on your host's private page. On fline, Claude Code can save a key it already holds without being able to read it back, but it has still seen that key.

This page in Markdown

Ask for early access

Built with Claude Code? Ask it to put it on fline. There's room for a small number of projects during the private beta, so we open accounts by hand, a few at a time, as room opens.

What fline does today

Until your account opens, we only email you about getting in: a confirmation when you join and an email when your account opens. Once your account is open, fline also sends a welcome, up to three short emails to help you get started (each stops once you've done that step), and emails about your launches. Every one of these has an unsubscribe link. No newsletter. No tracking script on this page, and your IP address is kept only as a salted hash. What we store