Most DeepSeek API tutorials assume a payment stack that a lot of Indonesian developers simply do not have: an internationally enabled credit card, a PayPal account that links cleanly, and a verification process that finishes in one sitting. The API call itself is the easy part. Getting a funded key — and keeping it alive through bank fraud rules — is where teams lose a day.
You do not need a Chinese phone number or a local bank account to run DeepSeek models in production. AiCredits sells DeepSeek credits payable by card or PayPal and exposes the same OpenAI-compatible endpoint. Below is the payment path that clears from Indonesia, followed by code you can run today.
The three walls Indonesian developers hit
The verification wall. Signing up at the source console asks for identity and payment details many developers here cannot supply quickly, and the errors rarely say which field is wrong.
The card wall. Plenty of debit cards issued in Indonesia ship with overseas e-commerce switched off or with a low monthly ceiling. The first charge fails with a generic decline, not an explanation.
The retry wall. After two declines most people hammer the button. The issuer's fraud engine reads that as card-testing behaviour and blocks the merchant for days.
The tooling wall. Even once payment works, teams rebuild streaming and retry logic from scratch because the tutorials assume a stable datacenter connection.
The payment checklist that actually clears
Work through this in order before you touch a checkout page. It is the difference between one attempt and an afternoon of declines.
Enable international and online transactions in your banking app first. Most major Indonesian banks expose that toggle, and changes can take a few minutes to propagate.
Confirm the balance covers the charge plus a temporary hold — issuers sometimes reserve more than the amount shown at checkout.
Use a card in your own name and copy the billing address exactly as the bank has it on file.
Do not switch VPN or network mid-checkout. An IP that changes country between page load and OTP is one of the clearest fraud signals there is.
Have the OTP device in hand. Letting a 3-D Secure prompt time out counts as a decline and increments the same counter.
If the checkout offers currency conversion, pay in the merchant's currency and let your bank do the conversion — store exchange rates are usually the worse deal.
Keep a second card or PayPal as a fallback, but try one method at a time with a pause in between.
Rule of thumb: never attempt the same card more than twice in a single day. A third failure is far more likely to burn the card than to succeed.
| Symptom | Likely cause | What to do |
|---|---|---|
| Generic decline on first try | Overseas/online transactions disabled on the card | Enable it in the banking app, wait a few minutes, retry once |
| Declined specifically at the OTP step | 3-D Secure session expired | Restart the checkout from scratch instead of resubmitting |
| Card worked last week, fails now | Issuer fraud flag after repeated retries | Call the bank and clear the flag; stop retrying |
| PayPal link rejected | Name or address mismatch with the card | Match the billing details exactly, then relink |
First successful call in under a minute
Install the SDK, export a key from your AiCredits dashboard, and run this. It is the standard OpenAI client with two fields changed — base_url and model — which is why migrating existing code is mostly a find-and-replace.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AICREDITS_API_KEY"],
base_url="https://api.aicreditsapi.com/v1",
)
response = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[
{"role": "system", "content": "You are a concise assistant. Answer in Bahasa Indonesia."},
{"role": "user", "content": "Jelaskan perbedaan async dan threading di Python dalam 3 poin."},
],
temperature=0.3,
max_tokens=400,
)
print(response.choices[0].message.content)
print("tokens used:", response.usage.total_tokens)
Measure latency from Jakarta before you architect around it
Published benchmarks measure a datacenter, not your IndiHome or Telkomsel path. Time to first token is the number that decides whether users tolerate your UI, so measure it from your own machine — and run it at the hours your users actually show up.
import os
import time
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AICREDITS_API_KEY"],
base_url="https://api.aicreditsapi.com/v1",
)
start = time.perf_counter()
first_token_at = None
parts = []
stream = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "Tulis tiga kalimat tentang lalu lintas Jakarta pada jam sibuk."}],
stream=True,
)
for chunk in stream:
if not chunk.choices:
continue
delta = chunk.choices[0].delta.content
if delta:
if first_token_at is None:
first_token_at = time.perf_counter() - start
parts.append(delta)
total = time.perf_counter() - start
print(f"first token: {(first_token_at or 0.0):.2f}s | total: {total:.2f}s")
print("".join(parts))
If time to first token feels slow, stream every response and keep prompts short — a smaller prompt reaches the first token sooner. If total duration is the problem, cap max_tokens and move long reference material into a cached prefix instead of repeating it in the user turn.
Retry logic matters more here than in a datacenter
Mobile and home connections drop mid-request often enough that a bare try/except is not enough. Retry connection and rate-limit errors with exponential backoff plus jitter, and never retry a 4xx validation error — that one is your bug, not the network's.
import os
import random
import time
from openai import OpenAI, APIConnectionError, RateLimitError
client = OpenAI(
api_key=os.environ["AICREDITS_API_KEY"],
base_url="https://api.aicreditsapi.com/v1",
)
def chat(messages, model="deepseek-v4-flash", max_attempts=5):
for attempt in range(1, max_attempts + 1):
try:
resp = client.chat.completions.create(
model=model,
messages=messages,
timeout=60,
)
return resp.choices[0].message.content
except (APIConnectionError, RateLimitError) as exc:
if attempt == max_attempts:
raise
delay = min(2 ** attempt, 20) + random.random()
print(f"[{attempt}/{max_attempts}] {type(exc).__name__} -> retry in {delay:.1f}s")
time.sleep(delay)
print(chat([{"role": "user", "content": "Sebutkan satu tips hemat token."}]))
Flash by default, escalate to pro only on validation failure
deepseek-v4-flash is the correct default: fast, inexpensive, and strong enough for chat, summarisation, classification, and structured extraction. deepseek-v4-pro costs more and responds more slowly but holds up better on multi-step reasoning and messy inputs. Instead of guessing per request, let the cheap model try first and escalate only when its output fails a check you can automate.
import json
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AICREDITS_API_KEY"],
base_url="https://api.aicreditsapi.com/v1",
)
SYSTEM = (
"Balas HANYA dengan JSON valid tanpa penjelasan tambahan. "
'Skema: {"ringkasan": string, "risiko": [string], "rekomendasi": string}'
)
def _parse(raw):
text = (raw or "").strip()
if text.startswith("```"):
text = text.split("\n", 1)[1].rsplit("```", 1)[0]
return json.loads(text)
def analyse(text, model="deepseek-v4-flash"):
resp = client.chat.completions.create(
model=model,
messages=[
{"role": "system", "content": SYSTEM},
{"role": "user", "content": text},
],
temperature=0,
)
return _parse(resp.choices[0].message.content)
def analyse_with_escalation(text):
try:
return analyse(text, "deepseek-v4-flash")
except ValueError:
return analyse(text, "deepseek-v4-pro")
sample = "Kontrak vendor berakhir 30 hari lagi dan belum ada perpanjangan tertulis."
print(json.dumps(analyse_with_escalation(sample), ensure_ascii=False, indent=2))
On pricing: flash is the cheaper default, pro costs more, cache hits are cheaper than fresh input, and off-peak traffic costs less than peak. Current rates live at aicreditsapi.com/pricing — read them there rather than trusting a number in a blog post, this one included.
Structure prompts so cache hits do the heavy lifting
Prompt caching rewards stable prefixes. Four habits cover most of the gain:
Put the fixed system prompt and reference documents first, the user's actual question last.
Never interpolate a timestamp, request ID, or username into the system prompt — it invalidates the prefix on every single call.
Batch similar jobs together so many requests share the same prefix while it is still warm.
Keep wording byte-identical across calls; a reworded system prompt is a brand-new prefix.
How the options compare
All three routes work. The difference is where the friction sits.
| Option | Strengths | Trade-offs |
|---|---|---|
| DeepSeek direct console | Closest to the source, full control over account settings | Verification and payment steps are awkward from Indonesia, and there is no local support channel |
| OpenRouter | One key across many vendors, easy model A/B testing | Routing margin on top, and behaviour shifts when the underlying route changes |
| AiCredits | DeepSeek credits payable by card or PayPal, no Chinese phone or bank needed, OpenAI-compatible endpoint | DeepSeek-focused catalogue rather than a general model marketplace |
If your team experiments across many vendors, OpenRouter's breadth is genuinely useful and worth keeping. If you mostly ship DeepSeek models and want a payment step that clears from an Indonesian card, AiCredits removes the part that usually blocks people.
FAQ
Debit works if your issuer allows online international transactions — enable that in the banking app first. Cards from digital banks and virtual cards often work too, as long as the name and billing address match.
No. Card payment is enough. PayPal exists as a fallback for people whose card keeps failing, not as a prerequisite.
No. Change base_url to https://api.aicreditsapi.com/v1, swap the key, and set model to deepseek-v4-flash. The chat completions shape stays the same, so your streaming and message handling keep working.
deepseek-v4-flash for almost everything, with deepseek-v4-pro reserved for cases where flash fails an automated check or the task is genuinely multi-step. That mix keeps quality where it matters without paying pro rates for boilerplate.
Retry connection errors with backoff and jitter, set an explicit timeout, and stream responses so users see output before the request completes. Do not retry 4xx errors — those fail identically every time.
Still stuck at DeepSeek's checkout?
This article explains why the payment fails. If what you actually need is a working key today, there is a shorter path: prepaid DeepSeek credits, no subscription, key issued to your account right after checkout.
- $9 / $19 / $29 USD one-time credit packs — 1 USD = 500K credits (so $9 = 4.5M); billed by actual usage, never expires, tax excluded
- Card, Apple Pay, Google Pay or Alipay via Creem — no PayPal account needed
- Email signup only — no Chinese phone number, no Chinese bank account
- Same DeepSeek models and the same OpenAI-compatible API — change one base_url
Get a DeepSeek key → Or try it free first
Not sure how prepaid billing works? See the full DeepSeek API credits guide → — packs, usage-based billing, supported models and payment methods.