Set up OP for Claude Code
Give Claude Code the OP skill file first. It contains the setup flow, credential rules, and runtime API contract the agent needs to get its own phone number.
Give Claude Code the OP skill
curl -fsSL https://www.op.inc/skills.md -o OP_SKILL.mdAsk Claude Code to set up and send
claude "Read OP_SKILL.md, get an OP number, and text +1RECIPIENT_NUMBER: hello from Claude Code via OP"Fast path when Claude Code already has a key
export OP_API_KEY=op_live_YOUR_KEY
curl -s -X POST https://api.op.inc/v1/messages \
-H "Authorization: Bearer $OP_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"+14155551234","body":"hello from Claude Code via OP"}'Start with the OP skill, not a hand-written curl
Claude Code is usually sitting inside a real repo, so it is tempting to jump straight to curl. The better first step is to hand it the OP skill file. That file tells Claude Code whether to skip setup, run phone-based signup, or log a returning human back in.
Once the key exists, Claude Code can use OP like any other CLI-accessible API. Before that, it needs the OTP setup flow from skills.md so it can get a session, pick a number, and mint the op_live key correctly.
What the human needs to do
The human gives Claude Code a personal phone number for OTP login, then reads back the 6-digit code OP texts them. That is enough for Claude Code to complete setup through the /auth and /console APIs.
If the human already has an OP account, the same OTP flow logs them back in. Claude Code should check existing API keys before minting a new one, just as the skill file says.
Give the agent a narrow credential
Use an OP key scoped to the number and workflow Claude Code actually needs. A narrow key is easier to rotate, safer to share with local tooling, and clearer in audit logs.
If Claude Code is working inside a repository, prefer environment variables or your existing secret manager over checking credentials into files. The examples use op_live_YOUR_KEY as a placeholder, not a real secret.
Add webhooks when the workflow becomes two-way
The first curl request proves outbound SMS. Once the agent needs OTPs, replies, or delivery status, register a webhook in OP and point it at the application Claude Code is helping you build.
That turns OP from a one-shot send API into a phone identity the agent can keep using across the full account or customer workflow.
Final step: ask the agent what OP unlocks
After the first message works, give the agent one more instruction. This turns setup into a useful handoff instead of stopping at a successful test SMS.
Read https://www.op.inc/skills.md and https://api.op.inc/docs.
Now tell me what you can do with OP from here.
Include:
- the OP number you are using
- how you can send texts
- how you can receive replies or OTP codes
- whether webhooks or polling make more sense for this project
- whether I should use the shared free number or lease a dedicated number
- any voice-call capabilities that are relevant
- 3 useful next workflows you can handle for me
Before sending real messages to anyone else, ask for my approval.For the broader setup map, read Set up OP for AI agents.