Skip to main content
The SinarCloud AI API lets you call many AI models through one endpoint that works with OpenAI SDKs and tools. You authenticate with API keys that you create in the console. You pay per token from the same prepaid rupiah balance that pays for your servers.

How the API works

The API follows the OpenAI API format. To move existing OpenAI code to SinarCloud, you change three settings: the base URL, the API key and the model alias. The base URL is https://ai.sinarcloud.com/v1. These endpoints are available under it: Each model supports only some of these endpoints. The Models page shows each model’s capabilities, prices and model alias. Streaming responses are supported. Errors use the OpenAI error format. For examples and error codes, see Send requests. Your account can have only a limited number of requests in progress at once. Extra requests fail with HTTP status 429 and the code rate_limit_exceeded. Retry when an earlier request finishes.

Authentication

Send your API key as a bearer token in the Authorization header:
Only SinarCloud API keys work. A key from OpenAI or any other service fails with the code invalid_api_key. You create and revoke keys on the API keys page. A key stops working when you revoke it or when it expires.

How you pay

  • Each model has its own price per 1M tokens, with separate prices for input and output tokens. Some models also have prices for reading from and writing to the prompt cache. See Models and pricing.
  • Promotions and new-signup offers can lower a model’s price. When a promotion applies to you, the prices on the Models page include it. The price and promotion in effect when a request starts apply to that request. If a promotion has a spending limit and the limit runs out before the request finishes, the promotion may discount less.
  • You are charged after a request finishes, for the tokens it used. The charge is deducted from your balance automatically.
  • If you have token credits for the model, they pay for the request’s tokens before your balance does. Your balance pays only for the rest. Requests under a 100% promotion don’t use your token credits while the promotion covers them.
  • If your balance is zero or negative and you have no token credits for the model, new requests to that model fail with HTTP status 402 and the code insufficient_balance. Requests that can’t cost you anything, such as requests under a 100% promotion, still work. Add balance to continue.
  • Because the charge comes after the request, a request can take your balance below zero. Your next top-up covers the negative amount first.
Your balance shows as Current Credits on the Billing page, under Account in the console sidebar. To see what your AI requests cost, click Usage under AI. See Usage and spending.
AI usage and VPS renewals draw from the same balance. If AI usage leaves too little balance when a server renews automatically, the renewal fails, and the server and its data are deleted shortly after its billing period ends. See Renewals and expiry.

Connect your code

The base URL is https://ai.sinarcloud.com/v1. Store your API key in an environment variable. See API keys.
For Python, install the OpenAI SDK with pip install openai. Then pass the three settings to the client. The example uses deepseek/deepseek-v4-1-flash. To call another chat model, replace it with that model’s alias. To copy an alias, click the copy icon next to it on the Models page.
For a step-by-step walkthrough, see Make your first AI request.

Next steps

Make your first AI request

Create a key and send a request in a few minutes.

Models and pricing

Compare models, capabilities and prices per 1M tokens.

API keys

Create, rename and revoke the keys your apps use.

Send requests

Call each endpoint and handle errors.

Playground

Try a model from the console before you write code.

Usage and spending

Review requests, tokens and charges in detail.

Token credits

See prepaid tokens per model and when they expire.

Add balance

Top up the balance that pays for AI and VPS.