Dokumentasi API

Kompatibel OpenAI. Kalau kode Anda sudah memakai OpenAI SDK, cukup ubah dua baris. Di bawah: panduan cepat 5 menit, lalu semuanya secara rinci.

Panduan cepat

  1. Buka Konsol API lalu buat kunci. Salin nilai cgw-sk-... — hanya ditampilkan sekali.
  2. Isi saldo USDT Anda lewat Tagihan. $1 sudah cukup untuk mencoba beberapa saat.
  3. Kirim permintaan:
cURL
curl https://cloudgpu.app/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $CGW_API_KEY" \ -d '{ "model": "deepseek-v4-flash", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Say hi in one sentence."} ] }'

Autentikasi

Setiap permintaan ke /v1/* requires an Authorization: Bearer cgw-sk-<your_key> header. Keys are scoped to your CloudGPU account. Revoke any key any time from the console; revocation takes effect immediately.

The raw key is shown exactly once at creation time. We store only a sha256 hash; we cannot recover it if you lose it. Create a new key if that happens.

Endpoint

MetodeJalurKegunaan
POST/v1/chat/completionsChat completion format OpenAI. Bentuk permintaan/respons sama dengan OpenAI.
GET/v1/modelsDaftar model yang tersedia + harga per token saat ini.

Embedding, function calling, vision, generasi gambar — ada dalam rencana, belum di v0.

Streaming

Sertakan "stream": true di body permintaan. Responsnya berupa Server-Sent Events format OpenAI. OpenAI SDK menanganinya secara transparan.

Python (streaming)
# Streaming — same client, stream=True for chunk in client.chat.completions.create( model="deepseek-v4-flash", messages=[{"role": "user", "content": "Count to 5."}], stream=True, ): delta = chunk.choices[0].delta.content if delta: print(delta, end="", flush=True)

SDK

Kami tidak menyediakan SDK sendiri — OpenAI SDK bisa langsung dipakai dengan base_url override.

Python
# pip install openai>=1.0 from openai import OpenAI client = OpenAI( api_key="cgw-sk-...", # from /api/console base_url="https://cloudgpu.app/v1", ) resp = client.chat.completions.create( model="deepseek-v4-flash", messages=[{"role": "user", "content": "Say hi."}], ) print(resp.choices[0].message.content) print(f"Used {resp.usage.total_tokens} tokens")
Node.js
// npm install openai import OpenAI from "openai"; const client = new OpenAI({ apiKey: process.env.CGW_API_KEY, baseURL: "https://cloudgpu.app/v1", }); const resp = await client.chat.completions.create({ model: "deepseek-v4-flash", messages: [{ role: "user", content: "Say hi." }], }); console.log(resp.choices[0].message.content);

Harga & penagihan

Every model is priced di bawah tarif vendornya sendiri for the same model — see the tabel harga. You pay per token, per image, per character or per second of audio depending on the model; nothing is metered by the hour and there is no monthly minimum.

Each request deducts from your prepaid balance. Successful calls show in your konsol within ~1 second with full token counts and dollar cost.

Tabel harga lengkap per model ada di halaman utama.

Batas laju

Per kunci API, per menit100 permintaan
Per akun, per hari10.000 permintaan

Nilai bawaan ini untuk mencegah penyalahgunaan selama beta publik. Hubungi kami kalau perlu dinaikkan — dengan senang hati untuk beban kerja yang nyata, cukup beri tahu kasus penggunaannya.

Kesalahan

Respons kesalahan mengikuti bentuk OpenAI: kode status HTTP + body JSON { error: { type, code, message } }.

StatuskodeKapan terjadi
401missing_authorizationTidak ada header Authorization.
401invalid_api_keyKunci tidak dikenal atau sudah dicabut.
400model_not_foundID model tidak ada di katalog. Lihat GET /v1/models.
402insufficient_balanceSaldo USDT di bawah $0,01. Silakan isi saldo.
429rate_limit_exceededBatas per menit atau per hari tercapai.
503upstream_not_configuredGateway sedang disiapkan — biasanya beres dalam hitungan jam.