🔌 API & Nền tảng•Trả phí•
OpenAI API
API platform của OpenAI cho GPT-5.x, o-series reasoning, DALL-E, Whisper và embeddings. SDK Python/JS, Responses API, fine-tuning và Batch API.
#openai-api
Danh mục
🔌 API & Nền tảng
Giá
Trả phí
GitHub Stars
⭐ 31,734
Ngôn ngữ
Python
License
Apache-2.0
Ngày thêm
2026-03-26
Tóm tắt từ README GitHub
OpenAI Python API library
)
The OpenAI Python library provides convenient access to the OpenAI REST API from any Python 3.10+
application. The library includes type definitions for all request params and response fields,
and offers both synchronous and asynchronous clients powered by HTTPX2.
It is generated from our OpenAPI specification.
Documentation
The REST API documentation can be found on platform.openai.com. The full API of this library can be found in api.md.
Installation
Usage
The full API of this library can be found in api.md.
The primary API for interacting with OpenAI models is the Responses API. You can generate text from the model with the code below.
The previous standard (supported indefinitely) for generating text is the Chat Completions API. You can use that API to generate text from the model with the code below.
While you can provide an keyword argument,
we recommend using python-dotenv
to add to your file
so that your API key is not stored in source control.
Get an API key here.
Workload Identity Authentication
For secure, automated environments like cloud-managed Kubernetes, Azure, and Google Cloud Platform, you can use workload identity au
Xem thêm từ README.mdThu gọn README.md
Đánh giá chi tiết
Tổng quan
OpenAI API là platform truy cập lập trình vào các model của OpenAI, bao gồm GPT-5.x cho text/code, o-series (o3, o4-mini) cho reasoning, DALL-E cho image generation, Whisper cho speech-to-text, và embedding models. Là API LLM được sử dụng rộng rãi nhất với hệ sinh thái SDK và tài liệu toàn diện.
Tính năng chính
- Responses API (mới): thay thế Chat Completions với tool use, web search và file handling tích hợp
- Chat Completions API: vẫn hỗ trợ vô thời hạn cho backward compatibility
- Vision: phân tích ảnh qua URL hoặc base64
- Async client với httpx, type definitions cho mọi request/response
- Fine-tuning: custom model trên dataset riêng
- Batch API: xử lý async hàng loạt, giảm chi phí ~50% so với real-time
- Structured Outputs: JSON schema enforcement cho output có cấu trúc
Stack kỹ thuật
REST API. SDK chính thức cho Python (openai-python, 30K+ stars, Apache-2.0) và Node.js. Generated từ OpenAPI spec bởi Stainless. Yêu cầu Python 3.9+.
Điểm mạnh
- Model mạnh nhất trên nhiều benchmark: GPT-5.x cho general task, o-series cho math/code reasoning
- Tài liệu API chi tiết nhất trong ngành, ví dụ code cho mọi endpoint
- SDK type-safe hoàn toàn, hỗ trợ cả sync và async
- Batch API giảm 50% chi phí cho workload không cần real-time
Hạn chế
- Chi phí tích lũy nhanh ở scale lớn, đặc biệt model reasoning (o3, o4-mini)
- Rate limit tier thấp có thể bottleneck production app mới
- Model versioning phức tạp: deprecation cycle ngắn, cần migrate thường xuyên
- Vendor lock-in nếu dùng nhiều tính năng specific như Assistants API hay Responses API
Phù hợp khi nào
Developer xây dựng ứng dụng AI cần model mạnh nhất với SDK hoàn thiện. Lựa chọn mặc định khi bắt đầu tích hợp LLM vào sản phẩm.