GPT-OSS

raw JSON →
0.0.9 verified Mon Apr 27 auth: no python

gpt-oss is a collection of reference inference implementations for GPT models, published by OpenAI. Current version is 0.0.9, requiring Python >=3.12. It is in early development with weekly releases.

pip install gpt-oss
error ModuleNotFoundError: No module named 'gptoss'
cause Incorrect import path - hyphen instead of underscore.
fix
Use from gpt_oss import ...
error ImportError: DLL load failed while importing gpt_oss
cause Missing or incompatible Microsoft Visual C++ Redistributable on Windows.
fix
Install the latest VC++ Redistributable from Microsoft.
breaking Python >=3.12 is required. Older versions will fail to install or import.
fix Upgrade Python to 3.12 or later.
deprecated The `generate` method's argument `max_tokens` has been renamed to `max_new_tokens` in v0.0.9.
fix Use `max_new_tokens` instead of `max_tokens`.
gotcha Import uses underscore (`gpt_oss`) not hyphen (`gpt-oss`).
fix Use `from gpt_oss import ...`

Initialize GPTInference with an API key from environment variable and generate a response.

from gpt_oss import GPTInference
import os

api_key = os.environ.get('OPENAI_API_KEY', '')
model = GPTInference(model_name='gpt-3.5-turbo', api_key=api_key)
response = model.generate("Hello, world!")
print(response)