ClaudeStore/Docs
⚠ These docs are a work in progress. Some content may be inaccurate or temporarily AI-generated.

Python SDK

Claude API Python SDK — install, configure, and send requests using the Anthropic Python library. Code examples included.

Anthropic SDK base URL: https://api2.claudestore.store. OpenAI SDK base URL: https://api2.claudestore.store/v1. Best for: Backend services, scripts, async jobs. Same API key: Yes.

Which Format Should I Use?

  • Choose Anthropic SDK if you want the native Messages API, native streaming events, and the lowest-friction Claude-only setup.
  • Choose OpenAI SDK if your app already uses the OpenAI Python client and you want to keep the same Chat Completions payload shape.
  • Both formats use the same ClaudeStore API key and the same Claude model IDs.
The most common setup mistake is mixing the client type and base URL. Anthropic SDK uses the bare domain; OpenAI SDK uses the /v1 suffix.

Anthropic SDK

Installbash
pip install anthropic
Basic usagepython
import anthropic

client = anthropic.Anthropic(
    api_key="YOUR_API_KEY",
    base_url="https://api2.claudestore.store"
)

message = client.messages.create(
    model="claude-sonnet-4.6",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Write a Python function to calculate fibonacci numbers."}
    ]
)

print(message.content[0].text)
Streamingpython
with client.messages.stream(
    model="claude-sonnet-4.6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain recursion."}]
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

OpenAI SDK

Installbash
pip install openai
Basic usagepython
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api2.claudestore.store/v1"
)

response = client.chat.completions.create(
    model="claude-sonnet-4.6",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is Python?"}
    ]
)

print(response.choices[0].message.content)
Streamingpython
stream = client.chat.completions.create(
    model="claude-sonnet-4.6",
    messages=[{"role": "user", "content": "Explain Python decorators."}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Common Mistakes

  • Pointing the Anthropic SDK at https://api2.claudestore.store/v1. For the native client, use https://api2.claudestore.store.
  • Pointing the OpenAI SDK at the bare domain. OpenAI-compatible clients should use https://api2.claudestore.store/v1.
  • Sending ClaudeStore API keys from browser-side Python environments. Keep keys in backend code, local tools, CI, or notebooks you control.

Ready to start?

Get API access to all Claude models in under 2 minutes.

View Plans