SuperPi.AI.Providers.OpenAI (super_pi v0.1.0)

Copy Markdown View Source

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 keyDefault
:openai_base_urlhttps://api.openai.com/v1
:openai_modelsthe models listed in /v1/models and the CLI
:openai_max_tokensunset (the API's default)
:openai_auth_commandunset; an executable that prints a short-lived bearer token to stdout
:openai_auth_timeout_ms10000
:openai_auth_cache_ttl_ms60000; 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.

Summary

Functions

The request body for a provider payload.

The Responses API body used for GPT-6 Astra.

Functions

build_body(payload, model \\ nil)

The request body for a provider payload.

build_responses_body(payload, model \\ nil)

The Responses API body used for GPT-6 Astra.