How to access o1-preview model?

Below is the code that I tried. The code worked with gpt-3.5-turbo, but not o1-preview-2024-09-12 or o1-preview. By not working I mean that the code finished and printed an empty response content…

Any tips?

from openai import OpenAI
client = OpenAI(api_key = “”
)

response = client.chat.completions.create(
model=“o1-preview-2024-09-12”,
messages=[
{“role”: “user”, “content”: “what does laogong mean in thai?”}
],
max_completion_tokens=300
)

print(response.choices[0].message.content)

1 Like

o1 being a reasoning model, I think your max_completion_tokens will all be used up by the reasoning, leaving none for the actual response. I think you would need a higher limit.

(I’d also generally recommend o3-mini instead, but that’s a different matter.)

2 Likes