# `SuperPi.AI.Providers.OpenAI`
[🔗](https://github.com/oleksandr/super-pi-beam/blob/v0.1.0/lib/super_pi/ai/providers/openai.ex#L1)

OpenAI Chat Completions and Responses APIs (`gpt-*`, `o1*`, `o3*`, `o4*`).

Configure with `OPENAI_API_KEY` or `config :super_pi, openai_api_key: "..."`. Other settings:

| Config key | Default |
|---|---|
| `:openai_base_url` | `https://api.openai.com/v1` |
| `:openai_models` | the models listed in `/v1/models` and the CLI |
| `:openai_max_tokens` | unset (the API's default) |
| `:openai_auth_command` | unset; an executable that prints a short-lived bearer token to stdout |
| `:openai_auth_timeout_ms` | `10000` |
| `:openai_auth_cache_ttl_ms` | `60000`; JWT expiry can shorten this, `0` disables caching |
| `:openai_responses_models` | `["gpt-6-astra"]` |
| `:openai_reasoning_effort` | `%{"gpt-6-sol" => "none"}`; a map from model name to effort |

Point `:openai_base_url` at an OpenAI-compatible server (Azure OpenAI, vLLM, Ollama, a proxy) to use
it. Models for such a server are listed with `:openai_models`; configured model names are also
recognized by this provider, including gateway aliases.

GPT-6 Astra uses the Responses API because its Chat Completions endpoint does not support
function calls at the reasoning efforts the model accepts. Configure additional Responses models
with `:openai_responses_models` and model effort with `:openai_reasoning_effort`.
Reasoning summaries and prompt caching controls are not implemented.

The request and the stream parsing are tested against a local server that replays the documented
event format. See `test/super_pi/ai/live_provider_test.exs` for the opt-in live test.

# `build_body`

The request body for a provider payload.

# `build_responses_body`

The Responses API body used for GPT-6 Astra.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
