AiCredits
Vietnam Guide

DeepSeek API for Vietnam Developers: Getting Started Without PayPal

Set up the DeepSeek API from Vietnam without PayPal: card payment, OpenAI SDK streaming code, model choice, retries, and cost control for production apps.

Published 2026-09-22 Updated 2026-09-22 7 min

The DeepSeek API is one of the most practical ways to put a strong reasoning model behind a production app, and from Vietnam the code side is genuinely simple: it speaks the OpenAI protocol, so most teams are a base_url and a model name away from a working request. The part that stops people isn't code. It's payment. A surprising number of AI providers assume you have PayPal, a US-issued card, or a Chinese phone number and bank account — and if you don't, the signup page is a dead end.

This guide walks the full path for a Vietnamese developer: paying without PayPal, making a first streaming call, choosing between deepseek-v4-flash and deepseek-v4-pro, and keeping spend predictable once you're in production. AiCredits issues DeepSeek API credits to international developers and accepts an international card or PayPal — no Chinese phone number or bank account required — with current rates published at aicreditsapi.com/pricing.

Paying without PayPal: what actually works

AiCredits supports two payment paths: an international card or PayPal. If PayPal isn't an option for you, the card route is the one most Vietnamese developers take. In practice that means a Visa or Mastercard — including a virtual card from a fintech you already use — with international online transactions switched on.

Two things trip people up. First, many cards issued in Vietnam ship with international online payments disabled by default, so you usually have to enable it inside your banking app before the first charge clears. Second, 3-D Secure verification has to complete while the checkout page is still open, so have your banking app ready before you hit pay.

Once credits appear in your dashboard, nothing else about the setup is region-specific. The same API key works from Hanoi, Da Nang, Ho Chi Minh City, or a CI runner in Singapore.

Before your first request

  • An API key from your AiCredits dashboard, stored as an environment variable (AICREDITS_API_KEY) — never committed to a repo.

  • Python 3.9+ with the official OpenAI SDK installed: pip install openai. The SDK version matters far less than the base URL you point it at.

  • The base URL https://api.aicreditsapi.com/v1, which is the same endpoint for every language SDK.

  • The two model names you'll actually use: deepseek-v4-flash (fast default) and deepseek-v4-pro (stronger, costs more).

  • A card with international online payments enabled if you're paying by card rather than PayPal.

Your first call, streaming

Streaming matters more than usual on a mobile connection: you start rendering output immediately instead of staring at a spinner. This script runs as written once AICREDITS_API_KEY is set.

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AICREDITS_API_KEY"],
    base_url="https://api.aicreditsapi.com/v1",
)

stream = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[
        {"role": "system", "content": "You are a concise technical assistant. Answer in the user's language."},
        {"role": "user", "content": "Giải thích sự khác biệt giữa async và await trong Python."},
    ],
    temperature=0.3,
    max_tokens=600,
    stream=True,
)

for chunk in stream:
    piece = chunk.choices[0].delta.content
    if piece:
        print(piece, end="", flush=True)
print()

If you already have OpenAI code sitting in your project, migration is two lines: the base_url and the model name. Your message shape, streaming loop, and error types stay exactly the same.

deepseek-v4-flash vs deepseek-v4-pro: pick deliberately

The temptation is to default to the stronger model "to be safe." Resist it. Most production traffic — extraction, classification, translation, summarisation, chat — is handled well by flash, and pro's advantage shows up on multi-step reasoning, tricky debugging, and long-context code review. Blended routing beats picking one model for everything.

ModelReach for it whenTradeoff
deepseek-v4-flashChat features, extraction, translation, classification, high-volume batch jobsFast default; weakest on multi-step reasoning
deepseek-v4-proHard debugging, long-context code review, ambiguous requirements, architecture questionsStronger answers, slower and costs more per call

A workable default for a Vietnamese SaaS: flash everywhere, and promote to pro only when a cheap check fails — malformed JSON, a refusal, or an answer noticeably shorter than expected.

Default to flash. Pay for pro only where a validation check tells you to.

A retry-and-escalate wrapper worth copying

Regional networks are fine most days and rough on others, so retries belong in the client rather than in a try/except you wrote once and forgot. This wrapper retries with exponential backoff and escalates to pro when the flash answer looks too thin.

import os
import time
from openai import OpenAI, APIError, APIConnectionError, RateLimitError

client = OpenAI(
    api_key=os.environ["AICREDITS_API_KEY"],
    base_url="https://api.aicreditsapi.com/v1",
)

SYSTEM = "You are a senior engineer. Be precise and concise."


def ask(prompt, model="deepseek-v4-flash", max_tokens=800, attempts=3):
    last_error = None
    for attempt in range(attempts):
        try:
            response = client.chat.completions.create(
                model=model,
                messages=[
                    {"role": "system", "content": SYSTEM},
                    {"role": "user", "content": prompt},
                ],
                temperature=0.2,
                max_tokens=max_tokens,
            )
            return response.choices[0].message.content
        except (RateLimitError, APIConnectionError, APIError) as exc:
            last_error = exc
            time.sleep(2 ** attempt)
    raise RuntimeError("request failed after retries") from last_error


def looks_thin(answer):
    return not answer or len(answer.strip()) < 40


def ask_with_escalation(prompt):
    answer = ask(prompt, model="deepseek-v4-flash")
    if looks_thin(answer):
        answer = ask(prompt, model="deepseek-v4-pro")
    return answer


if __name__ == "__main__":
    prompt = "Write a Python function that returns page N of size S from a list, plus pytest tests for the edge cases."
    print(ask_with_escalation(prompt))

Two habits worth forming early: keep temperature low unless the task is genuinely creative, and always set max_tokens. That parameter is your hard ceiling on a runaway response, which matters more than any prompt trick when you're watching a bill from a timezone nobody else is awake in.

Prompt caching: the optimisation you're probably skipping

Cache hits are billed more cheaply than fresh input, and the way to earn them is structural rather than clever: keep the static part of your prompt byte-identical across calls, and push everything that varies to the end.

STATIC_PREFIX = """You are the support assistant for a Vietnamese e-commerce store.
Rules:
- Reply in the customer's language.
- Never invent order IDs or delivery dates.
- Keep answers under 120 words.

<product catalogue and refund policy text — identical on every request>
"""


def build_messages(user_question):
    # Static prefix first (cache-friendly), variable content last.
    return [
        {"role": "system", "content": STATIC_PREFIX},
        {"role": "user", "content": user_question},
    ]

The classic mistake is interpolating a timestamp, request ID, or customer name into the system prompt. That changes the prefix, so every single call pays full price again. Move variable content into the user message and leave the prefix untouched.

Scheduling batch work around ICT (UTC+7)

Off-peak pricing is the other lever, and it fits Vietnamese working hours unusually well. Those windows are defined in UTC, which from UTC+7 lands late at night and into the early morning — exactly when you'd want a backfill or labelling job to run anyway. Check the current windows on aicreditsapi.com/pricing before you build a cron schedule around them.

A practical split: queue enrichment, dataset labelling, and reprocessing jobs to run overnight on deepseek-v4-flash, keep interactive and latency-sensitive features on flash during the day, and reserve deepseek-v4-pro for the jobs where a wrong answer costs more than a re-run.

FAQ

Can I use the DeepSeek API from Vietnam without PayPal?

Yes. AiCredits accepts an international card or PayPal, and requires no Chinese phone number or Chinese bank account. If a card is your route, enable international online transactions in your banking app first — many cards issued in Vietnam have that switched off by default.

Do I need a VPN or a local proxy?

No. It's a standard HTTPS API endpoint. If your code can reach any OpenAI-compatible provider, it can reach https://api.aicreditsapi.com/v1 with the same SDK.

Which model should a new project start with?

deepseek-v4-flash. It handles the overwhelming majority of application traffic, and you can add a validation check that escalates to deepseek-v4-pro only when an answer looks wrong or incomplete.

Can I keep using the OpenAI SDK and my existing code?

Yes, and that's the point. Change base_url to the AiCredits endpoint and the model name to deepseek-v4-flash or deepseek-v4-pro. Everything else — messages, streaming, tool calls — works as it did.

How do I avoid a surprise bill?

Set max_tokens on every call, default to flash, keep your static prompt prefix byte-identical so you earn cache hits, and schedule heavy batch work in off-peak windows. Current rates and windows are listed at aicreditsapi.com/pricing.

Getting started today

The shortest path is: create an AiCredits account, add credits with a card or PayPal, copy the key into AICREDITS_API_KEY, and run the streaming script above. That's the entire setup — no phone number games, no regional workarounds.

When you start shipping model-generated code into a real repository instead of a scratch file, AiCredits' code linting tools are worth a look too; they catch the kind of subtle issues that are easy to wave through when a model wrote the diff and you're reviewing it at 1 a.m. ICT.

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.

Try Lint in 2 seconds

Wrote something? Paste it here for a free grammar check. No account needed.

More Tools →

Related Tools

💻Code Explainer

Was this article helpful?

| Share on X Reddit Copy link

服务器宕机了?别等用户告诉你

Wakeless 梦哨 帮你 30 秒监控网站 / API / SSL 证书,宕机秒级告警到邮箱、飞书、Slack。免费档 30 个监控,永久免费,无需信用卡。

免费开始监控 →
💬
反馈意见 / Feedback ×