claude-code·Published 2026.06.01·Views 3
Claude Code /claude-api: Pull API Reference and Modernize Code
A beginner guide to /claude-api: pull Claude API reference for your language, and use migrate to update old code to match the latest model.
To wire Claude into your own program you have to look up how to use the API, but searching the official docs every time is a hassle. The command that pulls in the reference for the language you use is /claude-api.
Definition (what it is)
/claude-api is a command that pulls in Claude API reference tailored to the programming language you're using. And if you add migrate, it can also update outdated API code to match the latest model.
To unpack the terms: an API (Application Programming Interface) is "the agreed-upon channel through which your program asks Claude to do work and gets answers back." The reference includes usage for things like tool use (a feature that lets Claude call external tools) and streaming (receiving the answer bit by bit instead of all at once).
How to use it (by difficulty)
Basic — pull the reference
/claude-api
Typing this brings the API reference for the language you're working in into the session. From then on, when you ask "write code that receives answers via streaming," Claude builds accurate code based on that reference.
Applied — move old code to the new model
/claude-api migrate
Adding migrate (meaning to move/transfer) converts API code written the old way to match the latest model. When a new model changes the way calls are made, you can update automatically instead of fixing everything by hand.
Common pitfalls
- Don't blindly trust code changed by
migrate— run it once. The automatic conversion works well most of the time, but it's safer to check the special parts of your own code yourself. - The reference is pulled based on the language you use. When working in another language, it's best to pull it again from that language's environment.
Real-world example
When API call code you wrote earlier has gotten old and no longer matches the latest model, using /claude-api migrate updates the code to fit the new model's spec. You can clean up in one pass the parts that stopped working due to version differences.
Taking it further
Since it helps upgrade API code, swapping models becomes much smoother. Instead of dreading each new model release, you can stay continuously up to date with a flow of pulling the reference, checking it, and updating with migrate.
Summary
/claude-api is a command that pulls Claude API reference for your language, and adding migrate updates old code to match the latest model. It's a reliable helper when first wiring in the API or swapping models.
Based on Claude Code v2.1.154 (2026.05)
Comments
Comments 0
Checking sign-in status…
Loading comments…