59API

← Back to all guides

First Claude API Call in 5 Minutes: 2026 Quickstart

API · EN · 2026-10-19

Your first Claude response, in about five minutes

You need three things to call Claude: an API key, an available model ID, and the correct endpoint. This 2026 quickstart uses 59API’s OpenAI-compatible interface, so you can access Claude with familiar request formats and reuse the same integration pattern for GPT models.

59API is a low-cost, pay-as-you-go AI API relay offering native, official-quality models without downgrading them. Its base URL is https://api.59api.com. The steps below use Bash on macOS, Linux, or Windows through WSL, plus curl. No application framework is required.

Minute 1: Create an API key

Sign up for 59API when you’re ready to try the walkthrough, then create an API key in your account. Check that your account has enough credit for a small request. Treat this key like a password: keep it out of browser JavaScript, public repositories, screenshots, and shared logs.

In your terminal, run read -r -s API_KEY, paste your key, and press Enter. Bash stores it in a shell variable without displaying it or putting the pasted value into your command history. Keep this terminal open for the remaining steps.

Minute 2: Choose an available Claude model

Copy an exact Claude model ID from 59API’s current model list or documentation. Then run MODEL_ID='PASTE_THE_EXACT_MODEL_ID', replacing the placeholder. Model availability and identifiers can change, so copying the current ID is more reliable than using an old tutorial’s hardcoded model name.

For this first test, choose an available Haiku model for a small, economical request. Consider Sonnet for more demanding everyday development tasks, or Opus when your workload needs stronger reasoning. Compare the listed prices for the specific versions before choosing.

Minute 3: Send the request

Paste this single-line command into the same terminal:

curl --fail-with-body -sS https://api.59api.com/v1/chat/completions -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d "{\"model\":\"$MODEL_ID\",\"messages\":[{\"role\":\"user\",\"content\":\"Explain what an API is in one sentence.\"}],\"max_tokens\":128}"

This sends a short prompt through 59API’s OpenAI-compatible chat completions endpoint. The authorization header carries your relay key, model selects Claude, and max_tokens caps the generated response. The command assumes a recent curl version that supports --fail-with-body.

Notice the complete request URL: https://api.59api.com/v1/chat/completions. When configuring an OpenAI SDK instead, set its base URL to https://api.59api.com/v1; the SDK adds the endpoint path.

Minute 4: Read the response

A successful request returns JSON. Look for the generated text at choices[0].message.content. If the response includes a usage object, inspect its prompt and completion token counts to understand what this request consumed.

If something fails, use the HTTP status and response body together:

Minute 5: Keep costs and integration predictable

59API is among the cheapest relay options, with pay-as-you-go access that suits experiments and variable workloads. Compare current input and output token prices for your chosen model, since longer prompts and responses affect the final cost. Start with short prompts and modest output limits, then increase them when the task requires it.

For an application, keep requests on your server, set timeouts, and use bounded retries with backoff for transient failures. Avoid repeatedly retrying authentication or malformed-request errors.

59API also supports Claude Code, Codex, and OpenAI SDK integrations; follow the configuration instructions for each client. Its referral rebate may provide additional value if you recommend the service, subject to current terms. Your working request now gives you a concrete starting point for adding Claude to a script, backend, or development workflow.

Pricing · Docs

Ready to get started?

Connect Claude & GPT in minutes at the lowest prices — full-power, never downgraded. Sign up to get your API key.

Sign up free