Guide to Accessing International AI Large Models via Aggregation Tools, APIs, and Python Code
This article introduces major international and domestic AI large models, recommends desktop aggregation tools and APIs such as POE, Monica, and OpenRouter, and provides complete Python code examples for synchronous and streaming text and multimodal conversations, along with additional API and compute‑rental resources.
If you need to repeatedly leverage AI capabilities, the quality of the model is crucial; well‑known international models include Claude, GPT, Grok, Gemini, while domestic options include DeepSeek, Qwen, Doubao, etc.
Domestic AI models usually offer web and app versions, some with desktop clients, but accessing overseas high‑quality models can be difficult due to network restrictions. This guide compiles desktop tools, aggregation APIs, and compute‑rental services that simplify access to overseas models, based on research up to March 14 2025.
AI Aggregation Tools
POE – integrates foreign models (https://poe.com, credit‑card supported)
Monica – combines major domestic and overseas models (https://monica.im, credit‑card and Alipay supported)
OpenRouter – aggregation API for overseas models (https://openrouter.ai, supports credit‑card and other payment methods)
Actual Test Code
import aiohttp
import json
import asyncio
from typing import Optional, Dict, Any, AsyncGenerator
# API configuration
API_URL = "https://openrouter.ai/api/v1/chat/completions"
API_KEY = "sk-or-v1-YOU-SK"
# Default timeout (seconds)
DEFAULT_TIMEOUT = 120 # increased to 120 seconds
# Multimodal models (support text and images)
MULTIMODAL_MODELS = [
"anthropic/claude-3.7-sonnet",
"anthropic/claude-3.5-sonnet",
"openai/gpt-4.5-preview",
"openai/gpt-4o-2024-11-20",
"openai/o1",
"google/gemini-2.0-flash-001",
"google/gemma-3-27b-it",
"qwen/qwen-vl-max",
"qwen/qwen-vl-plus",
]
# Text‑only models
TEXT_ONLY_MODELS = [
"deepseek/deepseek-chat",
"deepseek/deepseek-r1",
"qwen/qwq-32b",
"qwen/qwen2.5-32b-instruct",
"mistralai/mistral-saba",
]
def supports_text(model: str) -> bool:
"""Check if the model supports text"""
return model in TEXT_ONLY_MODELS or model in MULTIMODAL_MODELS
def supports_image(model: str) -> bool:
"""Check if the model supports images"""
return model in MULTIMODAL_MODELS
async def chat_text(model: str, message: str, timeout: int = DEFAULT_TIMEOUT) -> str:
"""Pure text chat function
Args:
model: model name
message: user message
timeout: timeout in seconds
Returns:
Model's reply text
"""
if not supports_text(model):
raise ValueError(f"模型 '{model}' 不支持文本对话")
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {API_KEY}",
}
data = {"model": model, "messages": [{"role": "user", "content": message}]}
try:
print(f"正在调用模型 {model},请耐心等待...")
async with aiohttp.ClientSession() as session:
async with session.post(API_URL, headers=headers, json=data, timeout=timeout) as response:
if response.status != 200:
error_text = await response.text()
print(f"API错误状态码: {response.status}")
raise ValueError(f"API调用失败: {error_text}")
result = await response.json()
if not result.get("choices"):
print(f"API响应: {result}")
raise ValueError(f"API响应格式错误: {result}")
return result["choices"][0]["message"]["content"]
except aiohttp.ClientError as e:
raise ValueError(f"网络请求失败: {str(e)}")
except asyncio.TimeoutError:
raise ValueError("请求超时,请增加超时时间或稍后重试")
except Exception as e:
raise ValueError(f"请求失败: {str(e)}")
# Similar functions chat_text_stream, chat_image, chat_image_stream are defined below (omitted for brevity)
async def main():
test_image_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png"
print("\n1. 测试纯文本对话")
try:
response = await chat_text(model="deepseek/deepseek-chat", message="你是谁?")
print("回复:", response)
except ValueError as e:
print("错误:", str(e))
# Additional tests for streaming text, image, and streaming image omitted for brevity
if __name__ == "__main__":
asyncio.run(main())The code demonstrates how to check model capabilities, send synchronous and streaming requests for text and image inputs, handle errors, and print responses.
Additional Aggregation APIs
GPT‑Router: https://gpt-router.writesonic.com
Neutrino AI: https://www.neutrinoapp.com
Compute Rental Services
Modal – overseas compute rental platform (https://modal.com, credit‑card supported)
AutoDL – supports various AI cards from RTX to A800 (https://www.autodl.com, multiple payment options)
OpenBayes – affordable compute across OS platforms (https://openbayes.com, domestic payment methods)
Note: The listed resources are personal experiences and preferences, not advertisements.
Nightwalker Tech
[Nightwalker Tech] is the tech sharing channel of "Nightwalker", focusing on AI and large model technologies, internet architecture design, high‑performance networking, and server‑side development (Golang, Python, Rust, PHP, C/C++).
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.