Quickstart

From zero to your first successful API call in about two minutes. The only things you change versus calling the upstream provider directly are the base URL and the API key.

1. Create an account

Go to the login page and sign up with your email. No payment is required to create the account — you only top up when you're ready to send traffic.

2. Top up

From the dashboard, pick a plan and pay. The smallest plan is $15 (about 11,000 Haiku calls). After payment you'll get an API key in your inbox within seconds.

3. Pick your client family

Each family has its own SparkAPI entrypoint. Pick the one that matches the client you already use:

Claude / Anthropic

For Claude Code, Cline, and the official Anthropic SDK.

https://api.sparkapi.cc/api

Auth header: x-api-key: cr_…

Codex / OpenAI-compatible

For Cursor, OpenAI SDK, and any other OpenAI-shaped client.

https://api.sparkapi.cc/openai/v1

Auth header: Authorization: Bearer cr_…

Gemini

For the Google Generative AI SDK and raw Gemini REST calls.

https://api.sparkapi.cc/gemini

Auth header: Authorization: Bearer cr_…

4. Send a request

Copy-paste this into your terminal. It sends a 1-line prompt to Claude Sonnet and prints the response:

You → SparkAPI → Anthropic
curl https://api.sparkapi.cc/api/v1/messages \
  -H "x-api-key: $YOUR_SPARKAPI_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 64,
    "messages": [{"role": "user", "content": "Say hi in one short sentence."}]
  }'

You should see a JSON response with a content array. If you see 401, double-check the API key and header name — see the error codes page.

5. Use it in your code

Walk through the four steps below — each one is a one-line change versus what you'd write against the upstream provider.

1

Install the Anthropic SDK (you probably already have it).

2

Swap api_key= for your SparkAPI key.

3

Point base_url= at https://api.sparkapi.cc/api.

4

Call the same client.messages.create(...) you already use.

import anthropic

client = anthropic.Anthropic(
    api_key="YOUR_SPARKAPI_KEY",
    base_url="https://api.sparkapi.cc/api",
)

msg = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=64,
    messages=[{"role": "user", "content": "Say hi in one short sentence."}],
)
print(msg.content[0].text)

Using Claude or another OpenAI-compatible client? Point it at https://api.sparkapi.cc/openai/v1 and send Authorization: Bearer YOUR_SPARKAPI_KEY. For Gemini clients, use https://api.sparkapi.cc/gemini with the same Bearer token format. See API endpoints for the exact mapping per tool.

Next: Learn which models are available and how credits translate to requests on the Models page.