Skip to main content
The SinarCloud AI API is compatible with the OpenAI API. You can call it with the official OpenAI SDKs by changing three values: the base URL, the API key, and the model alias. This quickstart walks you through your first chat completion and shows you where to find what it cost. Before you start, sign in to the console with your Google account. On your first sign-in, confirm your time zone to finish setting up your account. You also need a terminal and one of these: cURL on macOS or Linux, Python 3, or Node.js.
1

Check your balance

AI requests are paid from the same prepaid rupiah balance as your VPS.In the console sidebar, under Account, click Billing. The Current Credits card at the top of the page shows how much balance you have left.
Billing page with the Current Credits card, the Redeem and Add Credit buttons, and the Transactions and Payments tabs. The Payments tab is open and lists three QRIS top-ups with the status Succeeded under the Invoice, Amount, Status, Method, Created and Actions columns.

The Current Credits card shows your balance

A request starts only if your balance is above Rp 0, you have token credits left for the model you call, or the request can’t cost you anything, for example under a 100% promotion. SinarCloud charges each request after it finishes, based on the tokens it used. This means a request can take your balance below zero.To add balance:
  1. Click Add Credit. The Add credit dialog opens on the same page.
  2. Click a preset amount, or type an amount from Rp 15,000 to Rp 10,000,000 in Amount. Balance after top-up shows your balance once the payment is confirmed.
  3. Click Continue to payment, then scan the QRIS code with any banking or e-wallet app that supports QRIS. Your balance goes up as soon as the payment is confirmed.
Add credit dialog over the Billing page, with the default Rp 100,000 in the Amount field, the current balance to the right of the Amount label, the allowed range below the field, and preset buttons from 50,000 to 500,000. Below them are a summary with You pay, Fee Free and Balance after top-up, the note that credit is non-refundable and can't be withdrawn, and the Continue to payment button.

Choose an amount, then click Continue to payment

Balance you add can’t be refunded or withdrawn. For details, see Add balance.
If a gift popup opens in the console, it offers free token credits for one AI model. Nothing is added to your account until you click Claim gift. Claimed tokens appear under AI > Token credits and pay for that model’s requests before your balance is charged. If the popup shows a Claim by date, claim the gift before then. Click Later to see the gift again the next time you open the console.
2

Create an API key

  1. Under AI, click API keys. The API Keys page opens.
  2. Click Create API key. You’ll find the button next to API endpoint at the top of the page and in the Your API keys section. Both open the same dialog.
  3. Enter a Key name, such as the app or environment that will use the key. You can rename the key later.
  4. To make the key stop working at a set time, fill in Expires at (optional). The field uses the time zone shown under it, which you can change in Account settings. Leave the field empty for a key that never expires.
  5. Click Create key.
  6. The dialog changes to Your key is ready and shows your key under New secret key. Click Copy secret, then click Done. If you close the dialog first, you can still copy the key later with Copy in the Your API keys list.
Create an API key dialog open over the API Keys page, with a Key name field, an Expires at (optional) date and time field with the time zone shown under it, and Cancel and Create key buttons

Name the key and optionally set an expiry

Keep your API key private. Anyone who has it can make API requests using your account. If a key leaks, click Revoke next to it, then click Revoke key to confirm. A revoked key stops working right away, and you can’t undo this.
3

Save your API key

The base URL is https://ai.sinarcloud.com/v1. On the API Keys page, the hint under the API endpoint box gives it. The box itself shows the full chat completions endpoint, https://ai.sinarcloud.com/v1/chat/completions.
API Keys page with the quick start at the top: the API endpoint box showing https://ai.sinarcloud.com/v1/chat/completions with a copy icon and a Create API key button, the hint that gives https://ai.sinarcloud.com/v1 as the base URL, and a Quick start (cURL) sample request for deepseek/deepseek-v4-1-flash with its own copy icon. The Your API keys list starts below it.

The base URL is in the hint under API endpoint

In the terminal where you will run the examples, save your API key as an environment variable:
  1. Under Your API keys, click Copy next to your key. You can skip this if you still have the key you copied in the previous step.
  2. Run the command for your system. Replace paste-your-api-key-here with your key, and keep the quotes.
The end of the Quick start (cURL) sample, followed by the Your API keys list with the number of keys, Refresh and Create API key buttons, and Key, Status, Created, Last used and Actions columns. Each key shows its name, the first characters of the key followed by dots, the scopes api:read and api:write, No expiry, the Active status, and Copy, Rename and Revoke actions.

Copy is next to each key under Your API keys

The variable lasts until you close the terminal, so run the examples in the same terminal.
4

Choose a model

  1. Under AI, click Models.
  2. To show chat models, click Text under the search box. To find a model, type its name, alias, or publisher in the search box, for example deepseek.
  3. Compare prices. The Input (Rp/1M) and Output (Rp/1M) columns show each model’s price per 1M tokens. Models tagged ZDR are zero data retention versions, which don’t keep your prompts and responses after your request is complete.
  4. Click Details on the model you want. The model’s details open in a dialog.
The Models page with Clear filters and Refresh at the top right and the search box below them, with deepseek entered. Under the search box, the All and Text mode buttons with counts sit above a table of DeepSeek models, one marked with the Popular sparkle icon and some tagged ZDR. The table has Model, Input, Output, Cache read, Cache write, and Context columns and a Details button on each row.

Search for a model, then click Details

On the Overview tab, check that Model capabilities lists Chat completions, because this quickstart calls the chat completions endpoint. Below the model name is the model alias, which is also called the model ID. Click the copy icon next to it (Copy model ID) to copy it.
The model details dialog for a DeepSeek model, showing its publisher, the Available, CHAT, and Popular badges, its alias with a copy icon, a button to get the model's API, and the Try in playground and Use via API buttons. Below are the prices per 1M tokens, with both cache write prices showing Not available, the context window and maximum output, and the Overview tab open with Supported inputs, Model capabilities with a description of each, and Publish date.

Check the model capabilities, then copy the alias

Model aliases are lowercase and usually look like publisher/model, for example deepseek/deepseek-v4-1-flash. The examples below use this alias. Replace it with the alias of the model you chose.
5

Send a chat completion

Run one of these examples in the same terminal where you set SINARCLOUD_API_KEY. The cURL example uses macOS and Linux shell syntax. On Windows, use the Python or Node.js example.
  • cURL: paste the command into your terminal and press Enter.
  • Python: install the SDK with pip install openai, save the code as example.py, and run python example.py. On macOS and Linux, use pip3 and python3 if pip or python isn’t found.
  • Node.js: install the SDK with npm install openai, save the code as example.mjs, and run node example.mjs.
The response uses the OpenAI chat completion format. The model’s reply is in choices[0].message.content. The cURL example prints the whole response as JSON. The Python and Node.js examples print only the reply.You can also copy a ready-made request from the console. In the model’s details, click Use via API. Under Sample usage, click cURL, Python, TypeScript, or Go, then click Copy code. The samples already include the base URL and the model’s alias. Before you run one, replace YOUR_API_KEY with your key. The samples put the key in the code, so don’t share or commit a file that contains it.
The model details dialog for a DeepSeek model with the Use via API tab open. Under Sample usage, a note says to replace YOUR_API_KEY and that the API URL and model alias are already included. Tabs for cURL, Python, TypeScript, Go, OpenCode, OpenClaw and Hermes sit above the cURL sample, which has a Copy code button and sends a request to https://ai.sinarcloud.com/v1/chat/completions for deepseek/deepseek-v4-1-flash.

Ready-made samples on the Use via API tab

On macOS or Linux, the API keys page has a ready-made request too. The Quick start (cURL) box holds a sample cURL request for a chat model. Click its copy icon (Copy cURL), replace YOUR_API_KEY with your key, and run it. To call a different model, swap in the alias of another model whose details list Chat completions under Model capabilities.
Every response includes an X-Request-Id header, including error responses. To see it with cURL, add -i to the command. For a successful request, the same ID appears as Request ID in its details on the Usage page while it is among your 8 most recent requests. Include the ID when you contact support, even for failed requests.
6

Find the request in Usage

Under AI, click Usage. The Log & Usage page opens on the Log tab, where Recent requests lists your 8 most recent settled requests with their model, time, tokens, cost, and latency.Only requests whose charge is final appear here, so failed requests aren’t listed. If you don’t see your request yet, click Refresh.
Log & Usage page with Date range, Model, and API key filters, a Refresh button, and cards for total charged, total saved, API requests, tokens processed, and average latency. The Log tab is open on the Recent requests list, with Show details on each request.

Recent requests on the Log tab

Click Show details on a request to see its Request ID, its status (Settled), and its input and output token counts. If token credits or a promotion lowered the price, the Cost column also shows the full price crossed out and the percentage you saved, and a Charge breakdown in the details shows how. The final cost is deducted from your balance.
The Log tab's Recent requests table with the newest request expanded. Its details show the Request ID, the input and output tokens with the cache hit and cache writes, and a Settled status.

Show details opens the request's Request ID, tokens, and status

If the request fails

Errors use the OpenAI error format. The code field tells you what went wrong.
The API key is missing, mistyped, expired, or revoked. Check that the Authorization header is Bearer followed by a space and your key. If the key has expired or been revoked, create a new one.
Your balance is Rp 0 or below, and you have no token credits left for this model. Add balance, then send the request again.
The model alias doesn’t exist, the model isn’t available right now, or it doesn’t support chat completions. On the Models page, search for the model’s name and copy its alias again. Then click Details and check that Model capabilities lists Chat completions. If the details show Temporarily unavailable, try again later or choose another model.
Your account has too many requests in progress at the same time. Wait for one to finish, then try again. If the message is “The model is receiving too many requests right now. Retry shortly.”, the model itself is busy. Try again in a moment, or choose another model.
Your key can’t make requests. On the API keys page, its row shows This API key is still being provisioned. The key won’t become usable by itself, so sending the request again doesn’t help. Create a new key and use it instead. The old key may change to Revoked later, and you can ignore it. If new keys also show this message, contact support.
SinarCloud or the model is temporarily unavailable, or the model didn’t respond in time. Wait a moment, then send the request again.
For other problems, see Troubleshooting.

Next steps

Send requests

Use streaming, other endpoints, and more request options.

Models and pricing

Compare models, capabilities, and prices per 1M tokens.

Playground

Chat with a model in the console without writing code.

Usage and spending

Track requests, tokens, and what you spend on each model.