Your First Claude API Call in 5 Minutes with 59API
Your first working Claude request, without the setup maze
You need three things to call Claude: an API key, an available model ID, and a small HTTP request. This quick-start uses 59API’s OpenAI-compatible interface, so you can start with curl and later reuse the same request structure in an OpenAI SDK.
59API is a low-cost, pay-as-you-go AI API relay with access to Claude and other model families through one service. Its API base URL is https://api.59api.com. This guide assumes you already have curl installed and are using a Bash-compatible terminal.
Minute 1: Get your key and choose a model
If you want to follow along, sign up for 59API, generate an API key, and make sure your account has enough credit for a small request. Keep the key private: it authorizes billable usage.
Choose an available Claude model in the dashboard or model catalog. Claude Haiku 4.5 is a practical model to consider for lightweight tasks; Claude Sonnet 5.5 is another option for more demanding development work. Check their current prices before choosing.
Copy the exact API model ID shown by 59API. A display name is not necessarily a valid request identifier. Do not invent a slug from the model’s name.
Minute 2: Store your API key locally
Run this command, paste your key at the prompt, and press Enter. Bash will hide the input and keep the key itself out of your command history:
read -r -s -p '59API key: ' API59_KEY; export API59_KEY; echo
The variable exists for this terminal session. Do not paste the key into source files, commit it to Git, or expose it in browser JavaScript. Production applications should make authenticated requests from a backend.
Minute 3: Send the request
Copy the following command and replace PASTE_EXACT_MODEL_ID with the identifier you copied. Leave the surrounding quotation marks intact:
curl --silent --show-error --fail-with-body --connect-timeout 10 --max-time 60 https://api.59api.com/v1/chat/completions -H "Authorization: Bearer $API59_KEY" -H "Content-Type: application/json" --data-raw '{"model":"PASTE_EXACT_MODEL_ID","messages":[{"role":"user","content":"Explain HTTP caching in two sentences for a backend developer."}],"max_tokens":150,"stream":false}'
This sends one user message and requests a non-streaming JSON response. The small output limit keeps the test focused. If your curl version does not support --fail-with-body, remove that option and inspect the returned response for errors.
The endpoint above uses the OpenAI-compatible chat format. It is not an example of Anthropic’s native Messages request format; do not mix authentication headers or payload fields from the two interfaces.
Minute 4: Find the generated answer
On a successful response, look for choices[0].message.content. That field contains the assistant’s answer. If the response includes a usage object, inspect it to understand the token consumption reported for this request.
A successful HTTP response plus meaningful assistant text confirms that your key, model identifier, endpoint, and request body work together. Save this minimal request before adding tools, conversation history, or streaming.
Minute 5: Fix the common blockers
- 401 or authentication error: Check that API59_KEY is set in the same terminal and contains the complete key.
- Model not found: Copy the API identifier again and confirm your account can access it.
- 400 or invalid request: Check JSON punctuation and preserve the messages array.
- 429 or quota error: Read the error details; check balance and rate limits before retrying.
- Timeout: Check connectivity and service status. Avoid blindly repeating potentially billable requests.
Keep your next experiment inexpensive
59API’s appeal is inexpensive, pay-as-you-go access without managing separate integrations for every model provider. It describes its models as native, official-quality offerings without downgrades. Compare current per-model prices and test your own workload rather than assuming every request costs the same.
For your next step, move this working request into a backend using an OpenAI SDK. Configure its base URL as https://api.59api.com/v1, supply your 59API key, and reuse the verified model ID. Keep prompts short while testing, then add functionality incrementally.