Quick Start

Complete your first Model API call in about 5 minutes.


Prerequisites

ItemRequirement
AccountRegistered at console.gogpu.cnopen in new window
BillingToken package purchased, or balance > 0 for pay-as-you-go
ToolsTerminal with curl, or Python 3.8+

Step 1: Choose billing mode

Option A: Token package (fixed budget)

  1. Console → Packages → purchase (one active package at a time).
  2. Confirm remaining tokens and validity in Package management.
  3. 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)

  1. Top up your account balance.
  2. Create a key with pay-as-you-go billing.
  3. Optionally set daily/monthly spend cap (CNY) (0 = unlimited).

See Billing for settlement details.


Step 2: Create an API key

  1. Console → API KEYCreate
  2. Name it (e.g. prod-chat)
  3. Select billing mode and package or limits
  4. 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

GoalDoc
Streaming, more clientsAPI Guide
Request body fieldsChinese: 请求参数说明
Console featuresChinese: 控制台使用指南
FAQFAQ
复制 MD