openai/openai-quickstart-python
openai/openai-quickstart-python has 1,832 GitHub stars and 1,351 forks. GitHot measured 0 stars in 24 hours and +1 in 7 days. Last checked 2026-11-12 19:24 UTC. Last push 2024-06-14.
Python example app from the OpenAI API quickstart tutorial
측정된 스타 증가
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalOpenAI API Quickstart - Python
This repository hosts multiple quickstart apps for different OpenAI API endpoints (chat, assistants, etc). Check out the examples folder to try out different examples and get started using the OpenAI API.
Basic request
To send your first API request with the OpenAI Python SDK, make sure you have the right dependencies installed and then run the following code:
from openai import OpenAI
client = OpenAI()
completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
)
print(completion.choices[0].message)
Setup
If you don’t have Python installed, install it from Python.org.
Clone this repository.
Navigate into the project directory:
$ cd openai-quickstart-pythonCreate a new virtual environment:
macOS:
$ python -m venv venv $ . venv/bin/activateWindows:
> python -m venv venv > .\venv\Scripts\activate
Install the requirements:
$ pip install -r requirements.txtMake a copy of the example environment variables file:
$ cp .env.example .envAdd your API key to the newly created
.envfile.Run the app:
This step depends on the app itself. If the code uses flask (like the chat-basic example), you can run:
$ flask run
You should now be able to access the app from your browser at the following URL: http://localhost:5000!
If the code is just a simple Python script, you can run it with:
$ python my_file.py
관련 프로젝트 살펴보기
sindresorhus/awesome
😎 온갖 흥미로운 주제에 관한 Awesome 목록 [참고: 기존 풀 리퀘스트를 따라잡을 여유가 생길 때까지 풀 리퀘스트가 일시적으로 비활성화되어 있습니다]
536,044 스타EbookFoundation/free-programming-books
:books: 무료로 이용할 수 있는 프로그래밍 도서
401,511 스타nilbuild/developer-roadmap
개발자의 커리어 성장을 돕는 인터랙티브 로드맵, 가이드 및 기타 교육 콘텐츠.
371,926 스타vinta/awesome-python
“Python으로 X를 하고 싶은데, 어떤 도구를 써야 할까?”에 답하는 결정판 목록.
334,381 스타