API Calling Guide
How to authenticate and call https://mass.gogpu.cn from curl, Python, and common AI clients.
Endpoints
| Action | Method | URL | Auth |
|---|---|---|---|
| List models | GET | https://mass.gogpu.cn/v1/models | Yes |
| Chat (OpenAI) | POST | https://mass.gogpu.cn/v1/chat/completions | Yes |
| Chat (Anthropic) | POST | https://mass.gogpu.cn/anthropic/v1/messages | Yes |
Base URL in clients
| Client type | Base URL |
|---|---|
| OpenAI SDK / Cursor / most CN clients | https://mass.gogpu.cn/v1 |
| Anthropic SDK | https://mass.gogpu.cn/anthropic |
Authentication
Send your console API key in the header:
X-API-Key: sk-YOUR_KEY
Some OpenAI clients use Authorization: Bearer sk-YOUR_KEY — both are supported where documented in console.
OpenAI-style chat
curl https://mass.gogpu.cn/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: sk-YOUR_KEY" \
-d '{
"model": "YOUR_MODEL_ID",
"messages": [
{"role": "user", "content": "Explain GPU cloud in one sentence."}
]
}'
Streaming
Add "stream": true to the JSON body and use a client that reads SSE chunks.
curl -N https://mass.gogpu.cn/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: sk-YOUR_KEY" \
-d '{
"model": "YOUR_MODEL_ID",
"stream": true,
"messages": [{"role": "user", "content": "Hi"}]
}'
Anthropic-style messages
curl https://mass.gogpu.cn/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "X-API-Key: sk-YOUR_KEY" \
-d '{
"model": "YOUR_MODEL_ID",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello"}]
}'
Configure third-party tools
| Tool | Base URL | API key |
|---|---|---|
| Cursor / Continue | https://mass.gogpu.cn/v1 | Console sk- key |
| Dify / FastGPT | OpenAI-compatible, https://mass.gogpu.cn/v1 | Same |
Model name must match the API model id from console or GET /v1/models.
Common errors {#common-errors}
Symptom / msg | Likely cause | Fix |
|---|---|---|
| Invalid key / auth failed | Wrong or revoked key | Create a new key in console |
| Insufficient balance | Pay-as-you-go balance empty | Top up account |
| Package exhausted | Token package used up | Buy a new package or switch key to pay-as-you-go |
| Model not found | Wrong model string | List models with GET /v1/models; copy id exactly |
code: 7 generic | See msg field | Match message to rows above |
More Q&A: FAQ. Detailed request fields (Chinese): /mass/request-params.html.
