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
- Buka Konsol API lalu buat kunci. Salin nilai
cgw-sk-...— hanya ditampilkan sekali. - Isi saldo USDT Anda lewat Tagihan. $1 sudah cukup untuk mencoba beberapa saat.
- Kirim permintaan:
cURLcurl 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
| Metode | Jalur | Kegunaan |
|---|---|---|
| POST | /v1/chat/completions | Chat completion format OpenAI. Bentuk permintaan/respons sama dengan OpenAI. |
| GET | /v1/models | Daftar 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 menit | 100 permintaan |
| Per akun, per hari | 10.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 } }.
| Status | kode | Kapan terjadi |
|---|---|---|
| 401 | missing_authorization | Tidak ada header Authorization. |
| 401 | invalid_api_key | Kunci tidak dikenal atau sudah dicabut. |
| 400 | model_not_found | ID model tidak ada di katalog. Lihat GET /v1/models. |
| 402 | insufficient_balance | Saldo USDT di bawah $0,01. Silakan isi saldo. |
| 429 | rate_limit_exceeded | Batas per menit atau per hari tercapai. |
| 503 | upstream_not_configured | Gateway sedang disiapkan — biasanya beres dalam hitungan jam. |