1. Install the small helper program
Install Python 3.11 or newer, then make an empty folder. Open a terminal in that folder
(PowerShell on Windows). Use the commands for your computer below. They install the tools that talk to the model;
the model itself stays on the provider’s servers.
Windows — PowerShell commands
py -m venv .venv
.venv\Scripts\python -m pip install --upgrade anthropic
Mac or Linux — terminal commands
python3 -m venv .venv
.venv/bin/python -m pip install --upgrade anthropic
2. Save this as hello.py
Use a plain-text editor. Save it in the same folder, with .py at the end, not .txt.
from getpass import getpass
import anthropic
client = anthropic.Anthropic(api_key=getpass("Paste your API key (hidden): "))
reply = client.messages.create(
model="claude-fable-5-1",
max_tokens=1024,
messages=[{"role": "user", "content": "Say hello in one short sentence."}],
)
for block in reply.content:
if block.type == "text":
print(block.text)
3. Run it and look for a reply
On Windows:
.venv\Scripts\python hello.py
On Mac or Linux:
.venv/bin/python hello.py
Paste your provider’s API key when asked and press Enter. It stays hidden as you type.
A short greeting means the connection works. Keep the key private; it lets programs use your account.
If it fails, check your account’s credit and model access, then use the provider’s setup guide below.
The example is adapted from their documentation.