Quick Start
Complete your first Model API call in about 5 minutes.
Prerequisites
| Item | Requirement |
|---|---|
| Account | Registered at console.gogpu.cn |
| Billing | Token package purchased, or balance > 0 for pay-as-you-go |
| Tools | Terminal with curl, or Python 3.8+ |
Step 1: Choose billing mode
Option A: Token package (fixed budget)
- Console → Packages → purchase (one active package at a time).
- Confirm remaining tokens and validity in Package management.
- When creating a key, choose package billing and bind the package.
Each call deducts tokens from the package based on usage in the response.
Option B: Pay-as-you-go (flexible usage)
- Top up your account balance.
- Create a key with pay-as-you-go billing.
- Optionally set daily/monthly spend cap (CNY) (0 = unlimited).
See Billing for settlement details.
Step 2: Create an API key
- Console → API KEY → Create
- Name it (e.g.
prod-chat) - Select billing mode and package or limits
- Copy the full key immediately (
sk-…) — shown only once
DANGER
Lost keys cannot be recovered. Revoke and create a new one. Never expose keys in public repos or web pages.
Step 3: List models
curl -sS https://mass.gogpu.cn/v1/models \
-H "X-API-Key: sk-YOUR_KEY"
Pick a model id from the response. The model field in requests must match exactly (case-sensitive).
Step 4: First chat completion
Replace the key and model name:
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": "Hello"}
]
}'
On success, choices[0].message.content is the reply; usage shows token counts.
If you get {"code":7,"msg":"..."}, see API Guide · Common errors.
Step 5: Python (optional)
from openai import OpenAI
client = OpenAI(
api_key="sk-YOUR_KEY",
base_url="https://mass.gogpu.cn/v1",
)
resp = client.chat.completions.create(
model="YOUR_MODEL_ID",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
Next steps
| Goal | Doc |
|---|---|
| Streaming, more clients | API Guide |
| Request body fields | Chinese: 请求参数说明 |
| Console features | Chinese: 控制台使用指南 |
| FAQ | FAQ |
