OpenAI-compatible examples for connecting applications to ModelPort Global.
ModelPort Global provides a unified AI API gateway for routing requests across multiple model providers through familiar API patterns. This repository collects practical examples for developers who want to connect tools, scripts, and AI applications quickly.
Website: https://www.modelportglobal.com/
ModelPort Global is designed for API aggregation across domestic Chinese models and global models, including examples such as DeepSeek, Qwen, GLM, Claude, and GPT.
Use the exact model name available in your ModelPort account when running these examples.
- Chat completions with an OpenAI-compatible endpoint
- Streaming responses for chat UIs and agents
- Tooling integrations for developer tools, internal apps, and custom AI workflows
- Usage tracking, model routing, and cost-aware development workflows
Set your endpoint and API key:
export MODELPORT_BASE_URL="https://www.modelportglobal.com/v1"
export MODELPORT_API_KEY="your_authorized_api_key"
export MODELPORT_MODEL="your-model-name"Run a simple request:
curl "$MODELPORT_BASE_URL/chat/completions" \
-H "Authorization: Bearer $MODELPORT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model-name",
"messages": [
{ "role": "user", "content": "Write a one-line product tagline for an AI gateway." }
]
}'| Folder | Description |
|---|---|
examples/curl |
Minimal command-line requests |
examples/node |
Node.js SDK-style usage |
examples/python |
Python SDK-style usage |
- OpenAI-compatible SDK clients
- AI chat desktop clients
- Agent frameworks
- Internal model routing services
- Usage dashboards and cost monitoring
| Name | Required | Description |
|---|---|---|
MODELPORT_BASE_URL |
Yes | API base URL for ModelPort-compatible requests |
MODELPORT_API_KEY |
Yes | Your authorized API key |
MODELPORT_MODEL |
No | Default model name used by examples |
Use this repository only with API keys and upstream services that you are authorized to access. Model availability, pricing, and routing behavior may vary by account and configuration.
- Website: https://www.modelportglobal.com/
- Pricing: https://www.modelportglobal.com/pricing
- Dashboard: https://www.modelportglobal.com/dashboard