1.6 KiB
parent, nav_order
| parent | nav_order |
|---|---|
| Connecting to LLMs | 100 |
OpenAI
To work with OpenAI's models, you need to provide your
OpenAI API key
either in the OPENAI_API_KEY environment variable or
via the --api-key openai=<key> command line switch.
Dev has some built in shortcuts for the most popular OpenAI models and has been tested and benchmarked to work well with them:
python -m pip install -U dev-chat
# o3-mini
dev --model o3-mini --api-key openai=<key>
# o1-mini
dev --model o1-mini --api-key openai=<key>
# GPT-4o
dev --4o --api-key openai=<key>
# List models available from OpenAI
dev --list-models openai/
# You can also store you API key in environment variables (or .env)
export OPENAI_API_KEY=<key> # Mac/Linux
setx OPENAI_API_KEY <key> # Windows, restart shell after setx
You can use dev --model <model-name> to use any other OpenAI model.
For example, if you want to use a specific version of GPT-4 Turbo
you could do dev --model gpt-4-0125-preview.
Reasoning models from other providers
Many of OpenAI's
"reasoning" models have restrictions on streaming and setting the temperature parameter.
Some also support different levels of "reasoning effort".
Dev is configured to work properly with these models
when served through major provider APIs and
has a --reasoning-effort setting.
You may need to configure reasoning model settings if you are using them through another provider and see errors related to temperature or system prompt.