Set up the AI’s API key

SOP SYS-02 · Technical systems manual

1 Purpose

Create the API key that lets the shop’s app send paperwork to the AI (Anthropic’s Claude), and put it where the app reads it, so that Have the AI read it works when someone checks a copy of paperwork (GRM-06) and the Technical workbench can run the AI.

2 Applies to

The person responsible for the shop’s database and AI. Repeat this procedure whenever a key expires, is lost, or may have been seen by someone it should not have been.

3 Before you begin

  • The shop’s app runs on this computer with Docker, from the dog-groomer-platform folder.
  • You can sign in to the Claude Console at platform.claude.com, or create an account there. The account pays for what the AI reads, so the shop must add a payment method or buy credits on the Console’s Billing page.
WarningThe key is a password

Anyone with the key can use the AI and the shop pays for it. Never email it, paste it in a chat, or put it in any file other than .env. The .env file is never saved to GitHub.

NoteWhat the AI is sent

When someone clicks Have the AI read it, the pages of that copy are sent to Anthropic’s API. The screen says so beside the button.

4 Procedure

4.1 Create the key

  1. Open a browser and go to platform.claude.com. Sign in.
  2. Go to the API keys page: platform.claude.com/settings/keys.
  3. Click Create key.
  4. Type a name that says what the key is for, for example “Grooming shop app”.
  5. Choose an expiration. When the key expires, the AI stops working until you repeat this procedure, so note the date.
  6. Set Linked account. Choose yourself, or a service account if the shop has one. A key linked to a person stops working if that person leaves the organization.
  7. Click the button to create the key. The Console shows the full key, which starts with sk-ant-. It is shown only once. Click the copy button beside it. Do not close the window until step 13.

4.2 Put the key in the app

  1. Open the dog-groomer-platform folder in File Explorer.

  2. Find the file named .env. If there is no .env, copy .env.example and rename the copy to .env.

    If File Explorer does not show .env, click View at the top of File Explorer, then Show, then tick File name extensions and Hidden items.

  3. Right-click .env, click Open with, and click Notepad.

  4. Find the line that starts with ANTHROPIC_API_KEY=. Click at the end of the line, after the =, and paste the key. If an old key is already there, delete it first. Nothing else goes on the line: no spaces and no quotation marks.

    ANTHROPIC_API_KEY=sk-ant-…your key…
  5. Find the line that starts with EXTRACTION_MODEL=. Make sure it names a current model, for example EXTRACTION_MODEL=claude-sonnet-5. The list of current models is at platform.claude.com/docs/en/about-claude/models.

  6. Click File, then Save. Close Notepad. You can now close the Console window.

4.3 Restart the app so it reads the key

  1. Open a terminal in the dog-groomer-platform folder.

  2. Type this command and press Enter:

    docker compose up -d --force-recreate api review

    Docker restarts the shop’s app and the Technical workbench. Wait until the terminal shows each one as Started.

4.4 Check that it works

  1. Open the shop’s app, sign in, open any dog’s card, and click Add paperwork. Take a photo or choose a file of any vaccine paperwork, click Save it, then click I’ll check it now.

  2. Look for the Have the AI read it button above the date form. Click it. After a short wait, the form shows The AI filled in a number of vaccines.

    If you do not want to keep this test copy, click Remove this copy and start again before step 17, or remove it afterwards from Admin. See MGR-05.

5 Result

Have the AI read it reads the pages and fills in the dates. The key appears on the Console’s API keys page, with the date it was last used.

6 If something goes wrong

6.1 The AI isn’t set up on this computer. Add ANTHROPIC_API_KEY and EXTRACTION_MODEL to .env.

One of the two lines in .env is empty, or the app was not restarted. Check steps 11 and 12, save the file, and repeat step 15.

6.2 The AI isn’t set up on this computer: the API key in .env was not accepted.

The key is wrong, has expired, or was deleted in the Console. Check that the line in .env has the whole key with no spaces. If it still fails, create a new key (steps 1 to 7) and replace the old one.

6.3 The AI model … named in .env doesn’t exist. Check EXTRACTION_MODEL.

The model name in .env is misspelled or no longer offered. Copy a current model name from the models page in step 12, save, and repeat step 15.

6.4 The key may have been seen by someone else

  1. On the Console’s API keys page, find the key and delete it. It stops working at once.
  2. Create a new key and put it in the app (steps 1 to 15).

6.5 The AI works, but the shop is spending more than expected

The Console’s Billing page shows what has been spent. Use workspaces in the Console to set a spend limit for the key’s workspace.