DEV Community

q409605362
q409605362

Posted on

How to Migrate from OpenAI to Asiatek AI in 5 Minutes

How to Migrate from OpenAI to Asiatek AI in 5 Minutes

Asiatek AI is an AI model API service built for Southeast Asian developers. With Singapore nodes delivering sub-50ms latency across the region, it offers a compelling alternative to Western-based providers.

The killer feature? Full OpenAI API compatibility. Just change two lines of code.


Why Migrate?

Southeast Asia Latency Advantage

If your users are in Southeast Asia, latency matters. Here's the difference:

Region US Endpoint Singapore Endpoint
Singapore ~200ms <10ms
Jakarta ~220ms <30ms
Bangkok ~210ms <35ms
Manila ~190ms <25ms

Every millisecond counts for real-time applications.

Pricing That Makes Sense

Compare the costs (USD per 1M tokens):

Model Input Output Use Case
qwen-turbo $0.08 $0.16 Fast, cheap tasks
qwen-coder-turbo $0.16 $0.48 Code generation
qwen-plus $0.84 $2.50 High-quality multilingual
qwen-coder-plus $1.12 $3.34 Code + reasoning
qwen-max $5.56 $16.66 GPT-4o equivalent
qwen-long $1.38 $4.16 Ultra-long context
qwen-math-plus $0.84 $2.50 Math reasoning
qwen-vl-plus $1.38 $4.16 Vision understanding
deepseek-chat $0.32 $1.32 128K context
deepseek-coder $0.32 $1.32 Code + 128K context
deepseek-reasoner $0.66 $2.63 Advanced reasoning

qwen-turbo is 97% cheaper than GPT-4o for basic tasks.

Multi-Language Native Support

Built for Southeast Asia? Models like qwen-plus handle Thai, Vietnamese, Indonesian, Malay, and more—with actual cultural context, not just translation.


Python Migration Guide

Before (OpenAI)

from openai import OpenAI

client = OpenAI(
    api_key="sk-...",
    base_url="https://api.openai.com/v1"
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

After (Asiatek AI)

from openai import OpenAI

client = OpenAI(
    api_key="ak-...",  # Your Asiatek AI API key
    base_url="https://api.asiatekai.com/v1"  # Changed!
)

response = client.chat.completions.create(
    model="qwen-plus",
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

Two lines changed. That's it.


Node.js Migration Guide

Before (OpenAI)

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
  baseURL: 'https://api.openai.com/v1'
});

const response = await client.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: 'Hello!' }]
});

console.log(response.choices[0].message.content);
Enter fullscreen mode Exit fullscreen mode

After (Asiatek AI)

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.ASIATEK_API_KEY,  // Changed!
  baseURL: 'https://api.asiatekai.com/v1'  // Changed!
});

const response = await client.chat.completions.create({
  model: 'qwen-plus',
  messages: [{ role: 'user', content: 'Hello!' }]
});

console.log(response.choices[0].message.content);
Enter fullscreen mode Exit fullscreen mode

cURL Example

curl https://api.asiatekai.com/v1/chat/completions \\
  -H "Authorization: Bearer $ASIATEK_API_KEY" \\
  -H "Content-Type: application/json" \\
  -d '{
    "model": "qwen-plus",
    "messages": [{"role": "user", "content": "What is 2+2?"}]
  }'
Enter fullscreen mode Exit fullscreen mode

Model Selection Guide

Choose based on your use case:

Use Case Recommended Model Why
Chatbot / General qwen-turbo or qwen-plus Fast or high-quality
Code Completion qwen-coder-turbo Optimized for code
Code + Reasoning qwen-coder-plus Complex code tasks
Complex Reasoning deepseek-reasoner Chain-of-thought
Long Documents qwen-long or deepseek-chat 128K+ context
Math Problems qwen-math-plus Specialized math
Image Understanding qwen-vl-plus Vision + text
Budget Everything qwen-turbo Cheapest option
GPT-4o Replacement qwen-max Same capability tier

Quick Decision Tree

Need vision?
├── Yes → qwen-vl-plus
└── No
    ├── Need code?
    │   ├── Yes → deepseek-coder (context) or qwen-coder-turbo (speed)
    │   └── No
    │       ├── Need reasoning?
    │       │   ├── Yes → deepseek-reasoner
    │       │   └── No
    │       │       ├── Long context?
    │       │       │   ├── Yes → qwen-long
    │       │       │   └── No
    │       │       │       └── qwen-plus (quality) or qwen-turbo (speed/cost)
Enter fullscreen mode Exit fullscreen mode

Advanced Features

Streaming Responses

from openai import OpenAI

client = OpenAI(
    api_key="ak-...",
    base_url="https://api.asiatekai.com/v1"
)

stream = client.chat.completions.create(
    model="qwen-plus",
    messages=[{"role": "user", "content": "Write a haiku about code"}],
    stream=True  # Enable streaming
)

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

Function Calling / Tools

response = client.chat.completions.create(
    model="qwen-plus",
    messages=[
        {"role": "user", "content": "What's the weather in Singapore?"}
    ],
    tools=[
        {
            "type": "function",
            "function": {
                "name": "get_weather",
                "description": "Get current weather for a city",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "city": {"type": "string", "description": "City name"}
                    },
                    "required": ["city"]
                }
            }
        }
    ],
    tool_choice="auto"
)

message = response.choices[0].message
if message.tool_calls:
    tool_call = message.tool_calls[0]
    print(f"Function: {tool_call.function.name}")
    print(f"Arguments: {tool_call.function.arguments}")
Enter fullscreen mode Exit fullscreen mode

JSON Mode

response = client.chat.completions.create(
    model="qwen-plus",
    messages=[
        {"role": "user", "content": "Return a JSON with name and age"}
    ],
    response_format={"type": "json_object"}
)
Enter fullscreen mode Exit fullscreen mode

FAQ

Do I need to change my code beyond base_url?

No. Asiatek AI uses the exact same API shapes as OpenAI. If you're using the OpenAI SDK, only two things change: api_key and base_url.

Is there a free tier?

Yes — sign up and get started without a credit card.

Can I use existing OpenAI code?

Yes! Just change:

  1. The api_key to your Asiatek AI key
  2. The base_url to https://api.asiatekai.com/v1
  3. The model name to one from Asiatek AI's model list

Everything else works.


Conclusion

Migrating to Asiatek AI is genuinely this simple:

  1. Get an API key from asiatekai.com
  2. Change base_url to https://api.asiatekai.com/v1
  3. Select a model from the available options

You get:

  • 4x faster latency for Southeast Asian users
  • 97% cost savings on basic tasks
  • Native multilingual support
  • Full OpenAI API compatibility

Stop paying premium prices for premium latency to US servers. Your users in Jakarta, Bangkok, and Manila will thank you.


Ready to migrate? Get your API key at asiatekai.com

Top comments (0)