Quickstart
Create an account, add balance and create an API key. Then use one of the examples below to send your first request.
-
Sign up. Go to console.indorouter.ai/signup and enter your email and a password of at least 12 characters. We’ll email you a verification link. Click it, then sign in.
If you see Continue with Google or Continue with GitHub, you can use those instead. You won’t need to verify your email again with either option.
-
Top up. Open Balance, pick or type an amount (at least Rp10.000) and click Continue to payment. You choose how to pay, such as QRIS, GoPay or a bank virtual account, on the Midtrans payment page.
The full top-up amount is added to your balance. VAT (PPN) is added to the payment total when applicable. You have 15 minutes to pay. Once you’ve paid, the balance updates immediately.
-
Create an API key. Open the API Key page, click Create API Key, give it a name (for example
laptop) and click Create key. Copy the key now, because we won’t show it again. It starts withir_.Keep it in an environment variable so it stays out of your code:
Terminal window export INDOROUTER_API_KEY="ir_..." -
Send a request. The base URL is
https://api.indorouter.ai/v1. The API is compatible with OpenAI’s, so the official OpenAI SDKs work as they are.Terminal window curl https://api.indorouter.ai/v1/chat/completions \-H "Authorization: Bearer $INDOROUTER_API_KEY" \-H "Content-Type: application/json" \-d '{"model": "openai/gpt-4o-mini","messages": [{"role": "user", "content": "hello"}]}'import osfrom openai import OpenAIclient = OpenAI(base_url="https://api.indorouter.ai/v1",api_key=os.environ["INDOROUTER_API_KEY"],)reply = client.chat.completions.create(model="openai/gpt-4o-mini",messages=[{"role": "user", "content": "hello"}],)print(reply.choices[0].message.content)import OpenAI from "openai";const client = new OpenAI({baseURL: "https://api.indorouter.ai/v1",apiKey: process.env.INDOROUTER_API_KEY,});const reply = await client.chat.completions.create({model: "openai/gpt-4o-mini",messages: [{ role: "user", content: "hello" }],});console.log(reply.choices[0].message.content);The model’s answer is in
choices[0].message.content. The request also shows up on the Requests page in the console, with what it cost.
Using another model
Section titled “Using another model”To use another model, replace openai/gpt-4o-mini with its model ID. A model ID always starts with the vendor. How to find the right one is on Choosing a model.
When a request is refused
Section titled “When a request is refused”| Status | code |
What it means |
|---|---|---|
| 401 | missing_api_key |
No Authorization header was sent. Check that INDOROUTER_API_KEY is set in the same terminal. |
| 401 | invalid_api_key |
The key is mistyped or was revoked. Create a new one on the API Key page. |
| 402 | insufficient_funds |
Your balance doesn’t cover this request. Top up, or send a smaller max_tokens. |
| 404 | model_not_found |
The model ID is misspelled or doesn’t start with the vendor. |