new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

openai/setup

13 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

OpenAI provider instance import

You can import the default provider instance 'openai' from @ai-sdk/openai, or use createOpenAI() to create a customized provider instance with custom settings.

OpenAI provider customization options

The createOpenAI function accepts optional settings: baseURL (string, defaults to https://api.openai.com/v1), apiKey (string, defaults to OPENAI_API_KEY environment variable), name (string, defaults to 'openai'), organization (string), project (string), headers (Record<string,string>), and fetch (custom fetch implementation).

OpenAI model factory selection

The default OpenAI model factory openai('model-id') uses the Responses API. If a custom base URL only supports the Chat Completions API, create chat models with openai.chat('model-id') instead, or use the OpenAI-compatible provider. Explicitly select a specific model API using .responses, .chat, or .completion.

OpenAI Responses API is default since AI SDK 5

Since AI SDK 5, the OpenAI responses API is called by default for openai('model-id') unless you explicitly specify openai.chat or another alternative.

OpenAI completion model factory method

You can create OpenAI completion models using openai.completion(modelId) factory method. Currently only gpt-3.5-turbo-instruct is supported.

OpenAI embedding model factory method

You can create OpenAI embedding models using openai.embedding(modelId) factory method.

OpenAI image generation model factory method

You can create OpenAI image generation models using openai.image(modelId) factory method.

OpenAI transcription model factory method

You can create OpenAI transcription models using openai.transcription(modelId) factory method with model id like 'whisper-1'.

OpenAI translation model factory method

You can create OpenAI translation models using openai.translation(modelId) factory method with model id like 'gpt-realtime-translate'. Translation models are streaming-only and used with experimental_streamTranslate.

OpenAI speech model factory method

You can create OpenAI speech models using openai.speech(modelId) factory method with model id like 'tts-1'. The voice argument can be set to: alloy, ash, coral, echo, fable, onyx, nova, sage, or shimmer.

OpenAI chat model factory method

You can create OpenAI chat models using openai.chat(modelId) factory method. The first argument is the model id, e.g. 'gpt-5'. Use this factory when a custom baseURL points at an OpenAI-compatible endpoint that implements Chat Completions but not the Responses API.

OpenAI responses model factory method

You can create OpenAI Responses API models using openai.responses(modelId) factory method, e.g. openai.responses('gpt-5.2').

OpenAI and OpenAI Compatible provider installation

The OpenAI provider is available in the @ai-sdk/openai module. The OpenAI Compatible provider is available via the @ai-sdk/openai-compatible module. Both can be installed with their respective package names using the package installer.

Give your agent this brain