cURL
Claude API with cURL — direct HTTP requests to Claude models. Copy-paste examples for quick API testing.
Native endpoint: POST /v1/messages. OpenAI-compatible endpoint: POST /v1/chat/completions. Best for: Smoke tests, CI, payload debugging. Streaming flag: --no-buffer.
Which Format Should I Use?
- Use Anthropic Messages API if you want the native Claude request format and native streaming event structure.
- Use OpenAI-compatible Chat Completions if you are debugging an OpenAI-style client or mirroring an existing OpenAI integration.
- The key difference is both the endpoint and the auth header format, so copy the right example for the client you are testing.
cURL is the fastest way to verify whether a setup issue is caused by your SDK wrapper or by the raw API request itself.
Anthropic Messages API
Basic requestbash
curl https://api2.claudestore.store/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4.6",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello!"}]
}'Streamingbash
curl https://api2.claudestore.store/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
--no-buffer \
-d '{
"model": "claude-sonnet-4.6",
"max_tokens": 1024,
"stream": true,
"messages": [{"role": "user", "content": "Hello!"}]
}'OpenAI-Compatible
Chat completionsbash
curl https://api2.claudestore.store/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4.6",
"messages": [{"role": "user", "content": "Hello!"}]
}'Streamingbash
curl https://api2.claudestore.store/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "content-type: application/json" \
--no-buffer \
-d '{
"model": "claude-sonnet-4.6",
"stream": true,
"messages": [{"role": "user", "content": "Hello!"}]
}'Utility Endpoints
List modelsbash
curl https://api2.claudestore.store/v1/models \
-H "x-api-key: YOUR_API_KEY"Detailed model infobash
curl https://api2.claudestore.store/v1/models/info \
-H "x-api-key: YOUR_API_KEY"Health checkbash
curl https://api2.claudestore.store/healthCommon Mistakes
- Using
Authorization: Bearerwith the native Messages API example. The native route expectsx-api-key. - Using
x-api-keywith the OpenAI-compatible example. That route should useAuthorization: Bearer YOUR_API_KEY. - Forgetting
--no-bufferwhile testing streaming, then assuming the stream is broken.