API Calling Guide

How to authenticate and call https://mass.gogpu.cn from curl, Python, and common AI clients.


Endpoints

ActionMethodURLAuth
List modelsGEThttps://mass.gogpu.cn/v1/modelsYes
Chat (OpenAI)POSThttps://mass.gogpu.cn/v1/chat/completionsYes
Chat (Anthropic)POSThttps://mass.gogpu.cn/anthropic/v1/messagesYes

Base URL in clients

Client typeBase URL
OpenAI SDK / Cursor / most CN clientshttps://mass.gogpu.cn/v1
Anthropic SDKhttps://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

ToolBase URLAPI key
Cursor / Continuehttps://mass.gogpu.cn/v1Console sk- key
Dify / FastGPTOpenAI-compatible, https://mass.gogpu.cn/v1Same

Model name must match the API model id from console or GET /v1/models.


Common errors {#common-errors}

Symptom / msgLikely causeFix
Invalid key / auth failedWrong or revoked keyCreate a new key in console
Insufficient balancePay-as-you-go balance emptyTop up account
Package exhaustedToken package used upBuy a new package or switch key to pay-as-you-go
Model not foundWrong model stringList models with GET /v1/models; copy id exactly
code: 7 genericSee msg fieldMatch message to rows above

More Q&A: FAQ. Detailed request fields (Chinese): /mass/request-params.html.


复制 MD