← All applications · Connect apps section on /docs
OpenAIManual setup
Python (openai)
Python (openai): hướng dẫn đặt URL cơ sở và khóa API trong mã tích hợp.
Published instructions · App version: unverified
Chat, ping, invoke and content-generation examples may send real billable requests. Check the model, balance, rate and minimum before running them. GET /v1/models checks authentication and the catalogue only. Set up environment variables safely
Base URL to paste
OpenAI SDKs generally use a URL ending in /v1; Anthropic SDKs use the root URL. Avoid adding /v1 twice. Protocol compatibility does not guarantee every provider feature.
https://apistack.vn/v1Prerequisites
- pip install openai
- API key
Recommended model: gpt-5.6-sol
Quick way — command / config
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["API_KEY"], base_url="https://apistack.vn/v1")
res = client.chat.completions.create(
model="gpt-5.6-sol",
messages=[{"role": "user", "content": "Hello!"}],
)
print(res.choices[0].message.content)Where to place file / fill Settings
Environment variableany
API_KEY
Đặt API_KEY trong môi trường tiến trình Python theo mục Bắt đầu nhanh. File .env không được tự nạp; không đưa key lên Git.
Verify connection
- Chạy script Python
Troubleshooting
| Symptom | Reason | How to handle |
|---|---|---|
| 404 | base_url thiếu /v1. | Phải là https://apistack.vn/v1. |