{"slug": "openai-erlang-sdk-native-openai-api-integration-for-erlang-otp", "title": "OpenAI Erlang SDK – Native OpenAI API Integration for Erlang/OTP", "summary": "Scalicon (SCALICON INC.) released version 0.1.0 of openai_erlang, an unofficial Erlang/OTP SDK that gives Erlang applications access to the OpenAI API, covering Responses, Chat Completions, streaming, structured outputs, tool calling, file uploads, audio, images and organization administration. The Hex package openai_erlang is not yet published, so Hex installation is unverified; Scalicon directs developers to build from a local checkout with rebar3 compile and rebar3 shell, and the documentation website is planned but not published. The SDK reads OPENAI_API_KEY by default via openai:new/1, and startup and Client construction open no network connections.", "body_md": "OpenAI Erlang SDK is an unofficial library that gives Erlang/OTP\napplications access to the OpenAI API. Developed by\n**Scalicon (SCALICON INC.)**, it supports Responses, Chat Completions,\nstreaming, structured outputs, tool calling, file uploads, audio,\nimages and organization administration.\n\n- [Official OpenAI REST API reference](https://platform.openai.com/docs/api-reference) .\n- [Official OpenAI OpenAPI specification](https://github.com/openai/openai-openapi) .\n- [Erlang API](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md) : direct resource operations and common SDK APIs.\n- [Public helpers](https://github.com/scalicon/openai-erlang/blob/main/docs/HELPERS.md) : parsing, polling, upload and iteration workflows.\n- [Release notes](https://github.com/scalicon/openai-erlang/blob/main/docs/RELEASE_NOTES.md) : version 0.1.0 scope, features and limitations.\n- [Detailed contracts](https://github.com/scalicon/openai-erlang/blob/main/docs/CONTRACTS.md) : authentication, transport,\nserialization, lifecycle and limitations.\n- [Python → Erlang API mapping](https://github.com/scalicon/openai-erlang/blob/main/docs/PYTHON-ERLANG-API-MAPPING.md) : resource\noperations, public helpers and common SDK APIs.\n- [Runnable examples](https://github.com/scalicon/openai-erlang/blob/main/examples/README.md) , including controlled local fixtures.\n- Documentation website: **planned, not published** at[https://scalicon.github.io/sdk/openai/](https://scalicon.github.io/sdk/openai/) .\n\n**Hex installation will be available after publication of version 0.1.0.**\nThese configurations describe that release; Hex installation has not been\nverified because the package is not published yet.\n\nThe Hex package is `openai_erlang`; the OTP application and module prefix\nremain `openai`.\n\nFor rebar3, add to `rebar.config`:\n\n```\n{deps, [\n    {openai, \"0.1.0\", {pkg, openai_erlang}}\n]}.\n```\n\nFor Erlang.mk, put this **before** `include erlang.mk`:\n\n```\nDEPS = openai\ndep_openai = hex 0.1.0 openai_erlang\n\ninclude erlang.mk\n```\n\nFor Mix, add the dependency to `deps/0` in `mix.exs` (keep your other entries):\n\n```\ndefp deps do\n  [\n    {:openai, \"~> 0.1.0\", hex: :openai_erlang}\n  ]\nend\n```\n\nAppend `openai` to the existing `applications` list in your consuming Erlang\napplication's `.app.src`. This is a configuration excerpt, not a runnable shell\ncommand. Preserve `kernel`, `stdlib` and all your other applications:\n\n```\n{applications, [\n    kernel,\n    stdlib,\n    %% ... keep the rest of your existing applications here ...\n    openai\n]}\n```\n\nBefore publication, build and try the SDK from a local checkout. Run these commands from the root of that checkout:\n\n```\nrebar3 compile\nrebar3 shell\n```\n\nSet your API key before starting the Erlang node:\n\n```\nexport OPENAI_API_KEY='your-api-key'\nrebar3 shell\n```\n\nFrom the Erlang shell, start the application, create a Client and make a Responses request:\n\n```\n{ok, _} = application:ensure_all_started(openai),\n{ok, Client} = openai:new(#{}),\n{ok, Response} = openai_responses:create(Client, #{\n    model => <<\"gpt-5.5\">>,\n    instructions => <<\"You are a coding assistant that talks like a pirate.\">>,\n    input => <<\"How do I check if a Python object is an instance of a class?\">>\n}),\nio:format(\"~ts~n\", [openai_response:output_text(Response)]).\n```\n\n`new/1` reads `OPENAI_API_KEY` by default; `api_key` can also be an explicit\nbinary or zero-arity credential callback. Startup and Client construction do\nnot open network connections. Model availability depends on your account.\nUnless stated otherwise, request examples below use this open `Client` and a\nfresh set of shell bindings; they are not one continuous paste. Paths and\nenvironment-dependent examples list their prerequisites. See\n[Managing resources](#managing-resources) for ownership and closing Clients.\nPaired examples retain the pinned README's models and payloads, including the\nomission of `store`; no `store => false` is silently added. Model access and\nservice defaults still depend on your account.\n\nChat Completions is also available:\n\n``` js\n{ok, Completion} = openai_chat_completions:create(Client, #{\n    model => <<\"gpt-5.5\">>,\n    messages => [\n        #{\n            <<\"role\">> => <<\"developer\">>,\n            <<\"content\">> => <<\"Talk like a pirate.\">>\n        },\n        #{\n            <<\"role\">> => <<\"user\">>,\n            <<\"content\">> => <<\"How do I check if a Python object is an instance of a class?\">>\n        }\n    ]\n}),\n#{<<\"choices\">> := [#{<<\"message\">> := Message} | _]} =\n    openai_response:to_map(Completion),\nio:format(\"~ts~n\", [maps:get(<<\"content\">>, Message)]).\n```\n\nThese introductory examples expect successful model responses. See\n[Handling errors](#handling-errors) and [Compatibility](#compatibility) for\nother outcomes. Additional SDK-specific examples use the same Client:\n\n```\n{ok, Models} = openai_models:list(Client),\n{ok, Embeddings} = openai_embeddings:create(Client, #{\n    model => <<\"text-embedding-3-small\">>,\n    input => <<\"Hello\">>\n}),\n{ok, Moderation} = openai_moderations:create(Client, #{\n    model => <<\"omni-moderation-latest\">>,\n    input => <<\"Hello\">>\n}).\n```\n\n| More implemented resources | Examples / API | \n|---|---|\n| Audio, Images, Uploads | [Media examples](https://github.com/scalicon/openai-erlang/blob/main/examples/README.md#media-resources) ,[API](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#media-resources) | \n| Batches, fine-tuning, Vector Stores | [Upload/poll workflows](https://github.com/scalicon/openai-erlang/blob/main/docs/HELPERS.md#vector-store-workflows) ,[example](https://github.com/scalicon/openai-erlang/blob/0.1.0/examples/vector_stores.erl) ,[API](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#batches-fine-tuning-and-vector-stores) | \n| Containers, Conversations, Decisions, Skills, Safety, signaling and provenance | [Platform examples](https://github.com/scalicon/openai-erlang/blob/0.1.0/examples/platform_resources.erl) ,[API](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#platform-resources) | \n| Organization administration | [Admin example](https://github.com/scalicon/openai-erlang/blob/0.1.0/examples/admin_organization.erl) ,[API](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#organization-administration) | \n\nPolling/upload helpers can make multiple requests; they do not automatically\nexecute tools or roll back remote uploads. Retired endpoints retain their pinned\nrequest contract; that does not make the remote service available.\nAdmin methods use `admin_api_key` / `OPENAI_ADMIN_KEY`; an admin-only Client is\nallowed. An admin key is not a fallback for ordinary bearer-only resources.\n\nFor a read-only example with `OPENAI_ADMIN_KEY` set:\n\n``` js\n{ok, Admin} = openai:new(#{api_key => <<>>}),\ntry\n    openai_admin_organization_groups:list(Admin, #{})\nafter\n    ok = openai:close(Admin)\nend.\n```\n\nWorkload identity exchanges short-lived subject tokens lazily. The helper\nfunctions return `{ok, Provider}`; pass that descriptor to `openai:new/1`.\nConstruction does not obtain a subject token or prove cloud authentication.\nThe metadata helpers' optional `timeout` is in milliseconds (default 10000);\n`null` disables that timer. Token refresh buffers use seconds instead.\nFor real requests, configure the identity provider and service account in your\norganization; `idp-123` and `sa-456` below are the reference's illustrative IDs.\nStart the application as in Usage before running these independent examples.\n\nPrerequisites: a mounted, readable service-account token with the configured audience/issuer, and an OpenAI workload identity mapping for that subject.\n\n```\n{ok, Provider} = openai_auth:k8s_service_account_token_provider(\n    <<\"/var/run/secrets/kubernetes.io/serviceaccount/token\">>\n),\n{ok, WorkloadClient} = openai:new(#{\n    workload_identity => #{\n        identity_provider_id => <<\"idp-123\">>,\n        service_account_id => <<\"sa-456\">>,\n        provider => Provider\n    }\n}),\ntry\n    openai_chat_completions:create(WorkloadClient, #{\n        model => <<\"gpt-5.5\">>,\n        messages => [#{<<\"role\">> => <<\"user\">>, <<\"content\">> => <<\"Hello!\">>}]\n    })\nafter\n    ok = openai:close(WorkloadClient)\nend.\n```\n\nPrerequisites: a supported Azure managed-identity metadata endpoint and an identity mapped to the OpenAI provider/account. This constructor-only example performs no metadata request; a later API call obtains the token lazily.\n\n```\n{ok, Provider} = openai_auth:azure_managed_identity_token_provider(#{\n    resource => <<\"https://management.azure.com/\">>\n}),\n{ok, AzureClient} = openai:new(#{\n    workload_identity => #{\n        identity_provider_id => <<\"idp-123\">>,\n        service_account_id => <<\"sa-456\">>,\n        provider => Provider\n    }\n}),\nok = openai:close(AzureClient).\n```\n\nPrerequisites: Google Compute metadata access and a service account able to obtain an ID token with this audience, mapped to OpenAI. No metadata request is made by this constructor-only example.\n\n``` js\n{ok, Provider} = openai_auth:gcp_id_token_provider(#{\n    audience => <<\"https://api.openai.com/v1\">>\n}),\n{ok, GCPClient} = openai:new(#{\n    workload_identity => #{\n        identity_provider_id => <<\"idp-123\">>,\n        service_account_id => <<\"sa-456\">>,\n        provider => Provider\n    }\n}),\nok = openai:close(GCPClient).\n```\n\nPrerequisite: implement a callback returning a real subject JWT trusted by your configured identity provider. The literal below preserves the reference example; it is not a usable credential. The callback is not invoked at construction.\n\n``` php\nProvider = #{\n    token_type => jwt,\n    get_token => fun() -> <<\"your-jwt-token\">> end\n},\n{ok, CustomClient} = openai:new(#{\n    workload_identity => #{\n        identity_provider_id => <<\"idp-123\">>,\n        service_account_id => <<\"sa-456\">>,\n        provider => Provider\n    }\n}),\nok = openai:close(CustomClient).\n```\n\nPrerequisite: a readable subject-token file at `/var/token` and the same identity\nmapping. `refresh_buffer_seconds` is in **seconds**, default 1200; HTTP timeout\noptions use milliseconds. As in the pinned example, this sets 120.0 seconds:\n\n```\n{ok, Provider} = openai_auth:k8s_service_account_token_provider(<<\"/var/token\">>),\n{ok, RefreshClient} = openai:new(#{\n    workload_identity => #{\n        identity_provider_id => <<\"idp-123\">>,\n        service_account_id => <<\"sa-456\">>,\n        provider => Provider,\n        refresh_buffer_seconds => 120.0\n    }\n}),\nok = openai:close(RefreshClient).\n```\n\nPrerequisites: X.509 federation enabled for your organization, matching provider\nand service-account IDs, a leaf-first certificate-chain PEM and matching private\nkey. Set `OPENAI_IDENTITY_PROVIDER_ID`, `OPENAI_SERVICE_ACCOUNT_ID`,\n`OPENAI_MTLS_CERTIFICATE_CHAIN` and `OPENAI_MTLS_PRIVATE_KEY`. Optional\n`OPENAI_MTLS_CA_BUNDLE` supplies server trust and\n`OPENAI_MTLS_PRIVATE_KEY_PASSWORD` unlocks an encrypted key. These environment\nvalues are read by this application example, not additional automatic SDK options.\n\n``` js\nCertificateTLSOptions = #{\n    certfile => unicode:characters_to_binary(os:getenv(\"OPENAI_MTLS_CERTIFICATE_CHAIN\")),\n    keyfile => unicode:characters_to_binary(os:getenv(\"OPENAI_MTLS_PRIVATE_KEY\"))\n},\nTrustedTLSOptions =\n    case os:getenv(\"OPENAI_MTLS_CA_BUNDLE\") of\n        false -> CertificateTLSOptions;\n        CAFile -> CertificateTLSOptions#{cacertfile => unicode:characters_to_binary(CAFile)}\n    end,\nTLSOptions =\n    case os:getenv(\"OPENAI_MTLS_PRIVATE_KEY_PASSWORD\") of\n        false -> TrustedTLSOptions;\n        Password -> TrustedTLSOptions#{password => unicode:characters_to_binary(Password)}\n    end,\n{ok, X509Client} = openai:new(#{\n    workload_identity => #{\n        type => x509,\n        identity_provider_id => unicode:characters_to_binary(\n            os:getenv(\"OPENAI_IDENTITY_PROVIDER_ID\")\n        ),\n        service_account_id => unicode:characters_to_binary(\n            os:getenv(\"OPENAI_SERVICE_ACCOUNT_ID\")\n        )\n    },\n    tls => TLSOptions,\n    follow_redirects => false\n}),\nok = openai:close(X509Client).\n```\n\nTokens are exchanged lazily at the fixed\n`https://mtls.auth.openai.com/oauth/token` endpoint, then cached/refreshed. The\ndefault API base is `https://mtls.api.openai.com/v1` unless explicitly configured\nor set by `OPENAI_BASE_URL`. API requests must remain HTTPS on that configured\norigin, with peer/hostname verification. This is certificate-backed **token\nexchange**, not merely [transport mTLS](#transport-configuration).\n\nOrdinary copies use independent lazy auth caches retained until the shared HTTP\ncontext closes. Explicit `openai_auth` handles are shared and separately owned.\nSee [subject authentication](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#subject-workload-authentication) and\n[X.509 contracts](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#x509-workload-authentication) for refresh and cleanup.\nVertex supports supplied callbacks and native Google credential subsets through\n`openai_providers:vertex/1`; see [provider options](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#http-providers).\n\n**TODO: executable credential providers (AWS `credential_process`\nand Google executable sources), AWS AssumeRole with MFA, and\nautomatic provider/workload authentication for WebSocket connections\nare not implemented.**\n\nApplication-supplied credential callbacks are supported separately.\n\nPrerequisites: an open `Client`, model access, and an image accessible to the\nservice. The SDK passes the URL to OpenAI without fetching it locally. This\nretains the pinned example's image URL, prompt and payload:\n\n```\nPrompt = <<\"What is in this image?\">>,\nImageURL =\n    <<\"https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg\">>,\n{ok, Vision} = openai_responses:create(Client, #{\n    model => <<\"gpt-5.5\">>,\n    input => [\n        #{\n            <<\"role\">> => <<\"user\">>,\n            <<\"content\">> => [\n                #{<<\"type\">> => <<\"input_text\">>, <<\"text\">> => Prompt},\n                #{<<\"type\">> => <<\"input_image\">>, <<\"image_url\">> => ImageURL}\n            ]\n        }\n    ]\n}).\n```\n\nAlternatively, provide a readable PNG at `path/to/image.png`. This complete\nexample sends the same prompt with a data URI:\n\n```\nPrompt = <<\"What is in this image?\">>,\n{ok, PNG} = file:read_file(\"path/to/image.png\"),\nBase64Image = base64:encode(PNG),\nImageURL = <<\"data:image/png;base64,\", Base64Image/binary>>,\n{ok, Vision} = openai_responses:create(Client, #{\n    model => <<\"gpt-5.5\">>,\n    input => [\n        #{\n            <<\"role\">> => <<\"user\">>,\n            <<\"content\">> => [\n                #{<<\"type\">> => <<\"input_text\">>, <<\"text\">> => Prompt},\n                #{<<\"type\">> => <<\"input_image\">>, <<\"image_url\">> => ImageURL}\n            ]\n        }\n    ]\n}).\n```\n\nA request blocks its **calling Erlang process**, not the entire VM. Run\nindependent requests in separate processes; separate async/await APIs are not\nrequired. For example:\n\n``` php\nParent = self(),\nRef = make_ref(),\n{Worker, Monitor} = spawn_monitor(fun() ->\n    Result = openai_responses:create(Client, #{\n        model => <<\"gpt-5.5\">>,\n        input => <<\"Explain disestablishmentarianism to a smart five year old.\">>\n    }),\n    Parent ! {Ref, self(), Result}\nend),\nreceive\n    {Ref, Worker, Result} ->\n        erlang:demonitor(Monitor, [flush]),\n        case Result of\n            {ok, Response} ->\n                io:format(\"~ts~n\", [openai_response:output_text(Response)]);\n            {error, Error} ->\n                {error, maps:get(kind, Error)}\n        end;\n    {'DOWN', Monitor, process, Worker, Reason} ->\n        {error, {worker_down, Reason}}\nend.\n```\n\nThe reference and worker PID correlate replies; only the matching monitor/PID\nhandles termination before a result. The result branch releases the monitor\nwith `demonitor(..., [flush])`. Unrelated mailbox messages are left untouched;\nthe example adds no HTTP deadline.\n\nA Client survives its creating process. Keep its shared HTTP context open until\nworkers finish; use `openai:close/1` when their work is complete. Concurrent\nrequests use separate connections; sequential HTTP/1.1 requests can reuse one.\nCapacity refusal is immediate rather than a waiting pool. A Stream must be\nopened and read by the same owner process.\n\nResponses and Chat support pull-based SSE. This is the pinned raw SSE example\nwith the same model/prompt. Prerequisites: an open `Client` and model access.\n\n``` js\n{ok, Stream} = openai_responses:create(Client, #{\n    model => <<\"gpt-5.5\">>,\n    input => <<\"Write a one-sentence bedtime story about a unicorn.\">>,\n    stream => true\n}),\ntry\n    openai_stream:consume(Stream, fun(Event) ->\n        io:format(\"~p~n\", [Event])\n    end)\nafter\n    ok = openai_stream:close(Stream)\nend.\n```\n\nThe SDK-specific `openai_responses:stream/2,3` helper additionally accumulates\nstate. For example, to collect a final Response (same payload, new request):\n\n``` js\n{ok, Stream} = openai_responses:stream(Client, #{\n    model => <<\"gpt-5.5\">>,\n    input => <<\"Write a one-sentence bedtime story about a unicorn.\">>\n}),\ntry\n    case openai_responses_stream:get_final_response(Stream) of\n        {ok, Final} -> openai_response:output_text(Final);\n        {error, Error} -> {error, maps:get(kind, Error)}\n    end\nafter\n    ok = openai_stream:close(Stream)\nend.\n```\n\n`next/1` returns `{ok, Event}`, `eos` or `{error, Error}`. Read metadata before\nclosing. `consume/2` and `fold/3` always close, including on callback exceptions.\nThe final helper drains its cursor and requires `response.completed`.\nFailed/incomplete responses remain events followed by `eos`. Open streams are\nnot automatically replayed. See [Responses](https://github.com/scalicon/openai-erlang/blob/0.1.0/examples/responses_stream.erl) and\n[Chat streaming examples](https://github.com/scalicon/openai-erlang/blob/0.1.0/examples/chat_completions_stream.erl).\n\nDirect WSS supports raw text/binary exchange. Prerequisites: an open `Client`,\nRealtime model access and a direct WSS-compatible network configuration.\nThe following adapts the reference's `gpt-realtime-2` text conversation to raw\nJSON messages; typed session/conversation methods are not available:\n\n``` js\n{ok, Connection} = openai_realtime:connect(Client, #{model => <<\"gpt-realtime-2\">>}),\nSend = fun(Event) ->\n    Bytes = iolist_to_binary(json:encode(Event)),\n    openai_realtime_connection:send_raw(Connection, {text, Bytes})\nend,\nRead = fun Next() ->\n    case openai_realtime_connection:recv_bytes(Connection, 15000) of\n        {ok, Bytes} ->\n            case json:decode(Bytes) of\n                #{<<\"type\">> := <<\"response.output_text.delta\">>, <<\"delta\">> := Delta} ->\n                    io:format(\"~ts\", [Delta]),\n                    Next();\n                #{<<\"type\">> := <<\"response.output_text.done\">>} ->\n                    io:format(\"~n\"),\n                    Next();\n                #{<<\"type\">> := <<\"response.done\">>, <<\"response\">> := Response} ->\n                    case maps:get(<<\"status\">>, Response) of\n                        <<\"completed\">> -> ok;\n                        _ -> {error, incomplete_response}\n                    end;\n                #{<<\"type\">> := <<\"error\">>} ->\n                    {error, realtime_error};\n                _ ->\n                    Next()\n            end;\n        {error, Error} ->\n            {error, maps:get(kind, Error)}\n    end\nend,\ntry\n    ok = Send(#{\n        <<\"type\">> => <<\"session.update\">>,\n        <<\"session\">> => #{\n            <<\"type\">> => <<\"realtime\">>,\n            <<\"output_modalities\">> => [<<\"text\">>]\n        }\n    }),\n    ok = Send(#{\n        <<\"type\">> => <<\"conversation.item.create\">>,\n        <<\"item\">> => #{\n            <<\"type\">> => <<\"message\">>,\n            <<\"role\">> => <<\"user\">>,\n            <<\"content\">> => [#{<<\"type\">> => <<\"input_text\">>, <<\"text\">> => <<\"Say hello!\">>}]\n        }\n    }),\n    ok = Send(#{<<\"type\">> => <<\"response.create\">>}),\n    Read()\nafter\n    ok = openai_realtime_connection:close(Connection)\nend.\n```\n\nOnly the opening owner may receive. Successful send is not proof of server\nreceipt; inspect server messages for protocol errors. An opened Connection\nsurvives Client close; Connection close does not close the HTTP Client.\nOwner death and application shutdown release it. See [WSS contracts](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#realtime-raw-wss).\nThe 15000ms receive timeout is an explicit Erlang example choice, not a reference\ndefault. A first `session.created` message is not a completed answer.\n\n**TODO: typed Realtime events/helpers and automatic reconnect are not implemented.**\nHTTP SDP signaling is available; the SDK does not include a WebRTC media engine.\n\nResources export Erlang types/specs for params, options and results. Client,\nResponse, Body, Stream and Page handles are opaque; use their public functions.\nJSON objects use maps, arrays lists, strings UTF-8 binaries and JSON null `null`.\nStructured parsing uses a strict wire schema and an application validator. This\nSDK-specific example intentionally sets `store => false`:\n\n``` js\nSchema = #{\n    <<\"type\">> => <<\"object\">>,\n    <<\"properties\">> => #{\n        <<\"ok\">> => #{<<\"type\">> => <<\"boolean\">>}\n    },\n    <<\"required\">> => [<<\"ok\">>],\n    <<\"additionalProperties\">> => false\n},\nValidator = fun(Bytes) ->\n    case json:decode(Bytes) of\n        #{<<\"ok\">> := Flag} = Value when is_boolean(Flag) -> {ok, Value};\n        _ -> {error, invalid}\n    end\nend,\nFormat = #{\n    name => <<\"flag\">>,\n    schema => Schema,\n    parse => Validator\n},\n{ok, ParsedResponse} = openai_responses:parse(Client, #{\n    model => <<\"gpt-5.5\">>,\n    input => <<\"Return ok=true.\">>,\n    store => false,\n    text_format => Format\n}),\n{ok, #{values := Values}} = openai_response:parsed(ParsedResponse).\n```\n\nThe SDK sends your schema; your application validates returned values. It does\nnot perform arbitrary JSON Schema validation or automatic class conversion.\n`Values` contains `{Path, Value}` pairs, retaining false/0/empty/null without\noverwriting server extras. Chat uses `response_format => {typed, Format}` with\n`openai_chat_completions:parse/2,3`. Validator failures return safe errors.\nSee [structured parsing](https://github.com/scalicon/openai-erlang/blob/main/docs/HELPERS.md#buffered-structured-parsing).\n\nList methods return immutable Pages. Prerequisites: an open `Client` and read\naccess to fine-tuning jobs. This preserves the reference's resource and limit;\nno following page is prefetched:\n\n**Manual next page**\n\n``` js\n{ok, Page} = openai_fine_tuning_jobs:list(Client, #{limit => 20}),\nItems = openai_page:items(Page),\nNext =\n    case openai_page:has_next_page(Page) of\n        true ->\n            io:format(\"Next page: ~p~n\", [openai_page:next_page_info(Page)]),\n            openai_page:get_next_page(Page);\n        false ->\n            done;\n        {error, Error} ->\n            {error, Error}\n    end.\n```\n\n**Alternatively, fold all pages**\n\n``` js\n{ok, Page} = openai_fine_tuning_jobs:list(Client, #{limit => 20}),\n{ok, JobsReversed} = openai_page:fold(Page, fun(Job, Acc) -> [Job | Acc] end, []),\nJobs = [openai_response:to_map(Job) || Job <- lists:reverse(JobsReversed)],\nio:format(\"~p~n\", [Jobs]).\n```\n\n`fold/3` visits items, `fold_pages/3` visits pages, fetching only as needed. Early\nhalt, for example `fun(Item, _) -> {halt, Item} end`, sends no next request.\nChoose one of the alternatives above; they are independent traversals.\nLoaded data/metadata survive Client close; fetching another page requires its\nopen HTTP context. See [pagination](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#pagination-and-list-resources)\nand the [runnable example](https://github.com/scalicon/openai-erlang/blob/0.1.0/examples/pagination.erl).\n\nUse atom keys for named top-level params and binary wire keys for nested JSON.\nWith an open `Client`, the pinned nested-parameter example becomes:\n\n``` js\n{ok, NestedResponse} = openai_responses:create(Client, #{\n    input => [\n        #{<<\"role\">> => <<\"user\">>, <<\"content\">> => <<\"How much ?\">>}\n    ],\n    model => <<\"gpt-5.5\">>,\n    text => #{\n        <<\"format\">> => #{<<\"type\">> => <<\"json_object\">>}\n    }\n}).\n```\n\nFunction tools are likewise nested data; the application explicitly handles returned tool calls. The SDK never executes them automatically.\n\nPrerequisites: an open `Client`, Files access and a readable `input.jsonl`.\nThis preserves the pinned `fine-tune` purpose and eager path upload:\n\n``` js\n{ok, Uploaded} = openai_files:create(Client, #{\n    file => {path, <<\"input.jsonl\">>},\n    purpose => <<\"fine-tune\">>\n}),\n#{<<\"id\">> := FileID} = openai_response:to_map(Uploaded).\n```\n\nFor in-memory audio, provide a readable `audio.wav`; this preserves the reference\nmodel, multipart filename and MIME. The SDK accepts bytes rather than a foreign\nfile-like object:\n\n```\n{ok, AudioBytes} = file:read_file(\"audio.wav\"),\n{ok, Transcription} = openai_audio_transcriptions:create(Client, #{\n    model => <<\"gpt-4o-transcribe\">>,\n    file => {<<\"audio.wav\">>, AudioBytes, <<\"audio/wav\">>}\n}).\n```\n\nUse `{Filename, Bytes, ContentType}` for overrides, or `{file, Path}` for an\nSDK-owned lazy file. The SDK opens/closes that source; arbitrary IO devices are\nnot accepted. Finite producer descriptors are supported, with explicit errors\nfor non-replayable body-preserving redirect/auth replay.\nSee [multipart](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#multipart-and-upload-sources).\n\nThe remote File remains yours to delete with `openai_files:delete(Client, FileID)`\nwhen no longer needed. Client close is local cleanup, not remote deletion.\n`openai_files:content/2,3` returns decoded binary bytes; raw/Body add metadata and\nstreaming download helpers. Download permissions depend on the service/purpose.\nSee [upload examples](https://github.com/scalicon/openai-erlang/blob/0.1.0/examples/multipart_upload.erl).\n\nVerification is local: pass **original body bytes**, not decoded/re-encoded\nJSON. Prerequisites: a Client configured with `webhook_secret` or\n`OPENAI_WEBHOOK_SECRET`, and your HTTP server's exact body/header values.\nThis handler fragment expects `OriginalBody` and `IncomingHeaders` from that\nserver; it does not start a web server:\n\n```\ncase openai_webhooks:verify_signature(Client, OriginalBody, IncomingHeaders) of\n    ok ->\n        Event = json:decode(OriginalBody),\n        {200, Event};\n    {error, _} ->\n        {400, <<\"Invalid signature\">>}\nend.\n```\n\n`OriginalBody` is a binary; headers are an ordered list of binary name/value pairs.\nThe result is `ok` or `{error, Error}`. Tolerance is in **seconds**, default 300.\nThe secret snapshot works after Client close and is never an API credential.\nSee [webhooks](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#webhooks) and the [synthetic local example](https://github.com/scalicon/openai-erlang/blob/0.1.0/examples/webhook_signature.erl).\n\n**TODO: webhook `unwrap` and typed event models are not implemented.**\n\nCalls return error maps rather than API-error exception classes. Match the\nfields needed, not an exact map. The reference example below needs fine-tuning\naccess and a valid training File; `file-abc123` is illustrative. A real successful\ncall creates a training job:\n\n``` js\ncase\n    openai_fine_tuning_jobs:create(Client, #{\n        model => <<\"gpt-4o\">>,\n        training_file => <<\"file-abc123\">>\n    })\nof\n    {ok, Job} -> {ok, Job};\n    {error, #{kind := rate_limit}} -> {error, try_later};\n    {error, #{kind := Kind} = Error} -> {error, Kind, maps:get(request_id, Error, undefined)}\nend.\n```\n\n| HTTP status / failure | Error `kind` | \n|---|---|\n| 400 / 401 / 403 / 404 | `bad_request` /`authentication_error` /`permission_denied` /`not_found` | \n| 409 / 422 / 429 | `conflict` /`unprocessable_entity` /`rate_limit` | \n| 5xx / other non-success status | `internal_server_error` /`api_status_error` | \n| Transport failure / timeout | `connection_error` /`timeout` | \n\n`message` is a safe summary; HTTP errors retain body, raw bytes, headers and\nrequest ID when available. `code` retains its JSON type. Server data can contain\nreflected sensitive input; do not log the entire error.\n\nPrerequisite: the `Response` obtained in Usage. This metadata-only adaptation\nreuses that value instead of issuing another reference example request.\nMetadata is separate from API data:\n\n```\nRequestID = openai_response:request_id(Response),\nMetadata = openai_response:metadata(Response).\n```\n\nPage, Body and Stream have their own `metadata/1`; read Stream metadata before\nclose. Error maps expose `request_id` when provided by the server.\n\nThe default is two retries, up to three attempts. Eligible connection/phase timeout failures and HTTP 408/409/429/5xx use backoff and supported server hints, subject to replayability. Open streams are not replayed after delivery.\n\nWith API credentials/model access, configure zero Client retries but override this Chat request to five, preserving the reference's model and prompt:\n\n``` js\n{ok, RetryClient} = openai:new(#{max_retries => 0}),\ntry\n    openai_chat_completions:create(\n        RetryClient,\n        #{\n            model => <<\"gpt-5.5\">>,\n            messages => [\n                #{\n                    <<\"role\">> => <<\"user\">>,\n                    <<\"content\">> => <<\"How can I get the name of the current day in JavaScript?\">>\n                }\n            ]\n        },\n        #{max_retries => 5}\n    )\nafter\n    ok = openai:close(RetryClient)\nend.\n```\n\nPer-request Options are the Erlang mapping used here for the reference's\nper-call `with_options` override. A handle derived with `openai:with_options/2`\nshares its original HTTP context; closing either closes both.\n\nTimeouts are **milliseconds**, not seconds. Defaults: connect 5000,\nread/write/pool 600000. A scalar applies to all four phases; a phase map must\nspecify all four. `null` disables timers. No total deadline is enabled by default:\n\nWith API credentials/model access, this preserves the reference's 20-second Client setting, granular 2/5/10/60-second settings and 5-second request override, converted to milliseconds:\n\n``` js\n{ok, TimedClient} = openai:new(#{timeout => 20000}),\n{ok, Granular} = openai:with_options(TimedClient, #{\n    timeout => #{\n        connect => 2000,\n        read => 5000,\n        write => 10000,\n        pool => 60000\n    }\n}),\ntry\n    openai_chat_completions:create(\n        Granular,\n        #{\n            model => <<\"gpt-5.5\">>,\n            messages => [\n                #{\n                    <<\"role\">> => <<\"user\">>,\n                    <<\"content\">> => <<\"How can I list all files in a directory using Python?\">>\n                }\n            ]\n        },\n        #{timeout => 5000}\n    )\nafter\n    ok = openai:close(TimedClient)\nend.\n```\n\n`total_timeout_ms` is a separate optional Erlang extension. Timeouts may retry\naccording to `max_retries`. See [timeouts](https://github.com/scalicon/openai-erlang/blob/main/docs/CONTRACTS.md#timeouts-and-retries) for\nphase semantics and current transport restrictions.\n\nUse Erlang/OTP Logger in your application. An SDK-specific logging configuration switch is not provided.\n\nOmitted named params and `undefined`/` omit` generally omit a wire field;\nexplicit `null` is JSON null where accepted. Constructor/copy options have their\nown inheritance rules; do not apply one omission rule to every Client option.\n\nUse `openai_response:to_map/1,2` and `to_json/1,2` for serialization.\n`exclude_unset` defaults true, `exclude_null` false. On the serialized map,\n`maps:is_key/2` distinguishes an absent key from a key whose value is `null`.\nFinite descriptors can apply defaults/coercion; raw bytes remain separate.\nDefault/API-name serialization retains extras. Keep API names to avoid\ncollisions in the optional named-view projection. Use `mode => native` or\n`mode => json` for supported model families and `exclude_null => true` to omit\napplicable nulls.\nSee [serialization](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#response-values) for exact presence/alias rules.\n\nPrerequisites: an open `Client` and Chat model access. Raw methods expose bytes,\nheaders and repeatable parsing. This preserves the reference's raw Chat payload:\n\n```\n{ok, RawResponse} = openai_chat_completions:create(\n    Client,\n    #{\n        messages => [\n            #{<<\"role\">> => <<\"user\">>, <<\"content\">> => <<\"Say this is a test\">>}\n        ],\n        model => <<\"gpt-5.5\">>\n    },\n    #{response_mode => {raw, chat_completion}}\n),\nBytes = openai_response:body(RawResponse),\nMetadata = openai_response:metadata(RawResponse),\nHeader = proplists:get_value(<<\"x-my-header\">>, [\n    {string:lowercase(Name), Value}\n || {Name, Value} <- maps:get(headers, Metadata)\n]),\nio:format(\"X-My-Header: ~p~n\", [Header]),\n{ok, Completion} = openai_response:parse(RawResponse),\n{ok, Completion} = openai_response:parse(RawResponse),\nio:format(\"~p~n\", [openai_response:to_map(Completion)]).\n```\n\nParse sends no new HTTP request. Raw SSE parse returns the same cursor without\nrewind. **Parsed-raw** methods instead return a Body handle with\nbuffered bytes, lazy validation and cached successful parse; errors are not\ncached. See [structured parsing](https://github.com/scalicon/openai-erlang/blob/main/docs/HELPERS.md#buffered-structured-parsing).\n\nBody mode returns after headers, then supports bytes/text/lines and file helpers.\nThis is HTTP body streaming, not semantic SSE. With an open `Client` and Chat\nmodel access, read chunks without first materializing the body. The request\npayload matches the reference; this variant uses byte chunks instead of its line\niterator. The explicit 64-byte reading unit is not a default or a response limit:\n\n```\n{ok, Body} = openai_chat_completions:create(\n    Client,\n    #{\n        messages => [\n            #{<<\"role\">> => <<\"user\">>, <<\"content\">> => <<\"Say this is a test\">>}\n        ],\n        model => <<\"gpt-5.5\">>\n    },\n    #{response_mode => {body, chat_completion}}\n),\nReadChunks = fun Next(Reader) ->\n    case openai_body:next(Reader) of\n        {ok, Chunk, NextReader} ->\n            io:format(\"Read ~B bytes~n\", [byte_size(Chunk)]),\n            Next(NextReader);\n        eos ->\n            ok;\n        {error, Error} ->\n            {error, maps:get(kind, Error)}\n    end\nend,\ntry\n    {ok, Reader} = openai_body:iter_bytes(Body, #{chunk_size => 64}),\n    ReadChunks(Reader)\nafter\n    ok = openai_body:release(Body)\nend.\n```\n\n`iter_bytes/1`, `iter_text/1` and `iter_lines/1` return `{ok, Reader}`.\n`openai_body:next(Reader)` returns `{ok, Chunk, NextReader}`, `eos` or an error;\ncontinue with `NextReader`. Partial reading does not create a replay cache.\nFull reads/parses materialize the body. Optional request `body_limits` set\nexplicit raw/decoded byte limits, without a hidden common cap.\nSee [Body API](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#lazy-http-bodies) and [example](https://github.com/scalicon/openai-erlang/blob/0.1.0/examples/http_body.erl).\n\nGeneric verb calls reuse the authenticated pipeline and require a response mode.\nThe reference's custom POST becomes a buffered raw JSON result; foreign HTTP\nresponse objects are intentionally not exposed. Prerequisites: a server at your\nconfigured base URL implementing `/foo`, and an open `Client`:\n\n``` js\n{ok, RawResponse} = openai:post(Client, <<\"/foo\">>, #{\n    response_mode => {raw, json},\n    security => #{bearer_auth => true},\n    json => #{<<\"my_param\">> => true}\n}),\n#{headers := Headers} = openai_response:metadata(RawResponse),\nFooHeader = proplists:get_value(<<\"x-foo\">>, Headers).\n```\n\nAn additional SDK-specific example shows request extras. With an open `Client`\nand model access:\n\n``` js\nopenai_responses:create(\n    Client,\n    #{\n        model => <<\"gpt-5.5\">>,\n        input => <<\"Hello\">>\n    },\n    #{\n        extra_headers => [{<<\"X-App-Name\">>, <<\"my-app\">>}],\n        extra_query => #{<<\"trace\">> => <<\"enabled\">>},\n        extra_body => #{<<\"metadata\">> => #{<<\"source\">> => <<\"readme\">>}}\n    }\n).\n```\n\nResource Options accept `extra_headers`, `extra_query` and `extra_body`; body\nextras shallowly override named fields. Binary-key response extras remain\navailable through `to_map`. Generic security flags and resource authentication\nare explicit, never inferred from URL text.\n\nThe SDK owns its Gun transport; HTTP-client injection and arbitrary foreign\ntransport options are unsupported. Configure typed `tls`, `proxy`, `base_url`,\n`default_headers` and `default_query` settings instead. HTTPS peer/hostname\nverification remains enabled.\n\nThe reference's test host/proxy are retained, with **HTTPS instead of HTTP** to\nfit this SDK's URL policy. This snippet configures Clients only; requests need\nreachable servers/proxy and trusted certificates at those addresses. Foreign\n`local_address`/HTTP transport objects are intentionally not translated:\n\n``` js\n{ok, ProxyClient} = openai:new(#{\n    base_url => <<\"https://my.test.server.example.com:8083/v1\">>,\n    proxy => <<\"https://my.test.proxy.example.com\">>\n}),\n{ok, DirectCopy} = openai:with_options(ProxyClient, #{\n    proxy => null,\n    default_headers => [{<<\"X-App-Name\">>, <<\"my-app\">>}]\n}),\nok = openai:close(DirectCopy).\n```\n\nClosing the copy also closes `ProxyClient`. To change routing per request,\nderive a Client with `with_options/2`, keeping credential/origin restrictions in\nmind; request Options are for documented per-call settings, not transport objects.\n\nFor API-key transport mTLS, prerequisites are the service's mTLS enrollment,\n`OPENAI_API_KEY`, certificate-chain/key files and optional CA/password environment\nvariables listed in the X.509 section. This is a separate, complete setup; it\ndoes **not** configure workload identity:\n\n``` js\nCertificateTLSOptions = #{\n    certfile => unicode:characters_to_binary(os:getenv(\"OPENAI_MTLS_CERTIFICATE_CHAIN\")),\n    keyfile => unicode:characters_to_binary(os:getenv(\"OPENAI_MTLS_PRIVATE_KEY\"))\n},\nTrustedTLSOptions =\n    case os:getenv(\"OPENAI_MTLS_CA_BUNDLE\") of\n        false -> CertificateTLSOptions;\n        CAFile -> CertificateTLSOptions#{cacertfile => unicode:characters_to_binary(CAFile)}\n    end,\nTLSOptions =\n    case os:getenv(\"OPENAI_MTLS_PRIVATE_KEY_PASSWORD\") of\n        false -> TrustedTLSOptions;\n        Password -> TrustedTLSOptions#{password => unicode:characters_to_binary(Password)}\n    end,\n{ok, TLSClient} = openai:new(#{\n    api_key => unicode:characters_to_binary(os:getenv(\"OPENAI_API_KEY\")),\n    base_url => unicode:characters_to_binary(\n        os:getenv(\n            \"OPENAI_BASE_URL\", \"https://mtls.api.openai.com/v1\"\n        )\n    ),\n    tls => TLSOptions,\n    follow_redirects => false\n}),\nok = openai:close(TLSClient).\n```\n\nServer trust is independent of the client certificate. Keep certificate-bearing\nClients dedicated to the configured API origin; do not repurpose a copy for\nanother origin. Keep redirects disabled. Rotate certificates by constructing a\nnew Client and closing the old one after its requests finish.\nSee [TLS/proxy/redirect options](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#tls-proxy-and-redirects), including\nthe current HTTPS-only URL policy and credential isolation rules.\n\nA Client's HTTP context survives its creating process. Close it explicitly with\n`openai:close/1`; application shutdown also closes SDK contexts.\n`openai:with_options/2` and `openai:copy/2` share that context: closing any copy\ncloses all of them. Use `openai:new/1` for independent lifetimes. Request, Body,\nStream and Realtime Connection ownership is separate; see\n[lifetime and cleanup](https://github.com/scalicon/openai-erlang/blob/main/docs/CONTRACTS.md#lifetime-ownership-and-cleanup).\nUse `try/after` in application code:\n\n```\n{ok, OwnedClient} = openai:new(#{}),\ntry\n    {ok, Response} = openai_responses:create(OwnedClient, #{\n        model => <<\"gpt-5.5\">>,\n        input => <<\"Say this is a test\">>\n    }),\n    io:format(\"~ts~n\", [openai_response:output_text(Response)])\nafter\n    ok = openai:close(OwnedClient)\nend.\n```\n\nActive close success confirms cleanup; an already dead context is a safe no-op, not historical cleanup proof. Buffered Responses and loaded Page data remain usable after close; future requests/page fetches do not.\n\nBody close confirms network cleanup while retaining full cache/parser buffers.\nBody release also closes associated cursors, frees cache and confirms owner\nDOWN. Complete cached read/parse survives Body/Client close until release;\nmaterialized values survive release. Stream close finally closes its cursor.\nUse `try/after` or `openai_body:with/2` for release. Local cleanup never deletes\nremote Files, Vector Stores or other API objects.\n\n**TODO: a dedicated Azure OpenAI client with deployment routing, API-version\nhandling and Azure-specific authentication options is not implemented.** Azure\nmanaged identity as a workload subject provider is available; it is not an\nAzure OpenAI client.\n\nPrerequisites: AWS credentials with access to Bedrock's OpenAI-compatible API,\nthe selected model in `us-west-2`, and the application started as in Usage.\nThe default-chain example preserves the reference's region/model/prompt. Leave\n`AWS_BEARER_TOKEN_BEDROCK` unset to exercise AWS credentials rather than its\nhigher-priority bearer mode:\n\n``` js\n{ok, Bedrock} = openai_providers:bedrock(#{region => <<\"us-west-2\">>}),\n{ok, BedrockClient} = openai:new(#{provider => Bedrock}),\ntry\n    {ok, Response} = openai_responses:create(BedrockClient, #{\n        model => <<\"openai.gpt-5.4\">>,\n        input => <<\"Say hello!\">>\n    }),\n    io:format(\"~ts~n\", [openai_response:output_text(Response)])\nafter\n    ok = openai:close(BedrockClient)\nend.\n```\n\nFor a named profile, configure `my-profile` (including region and supported\ncredentials) in your AWS files. The request below uses the same payload:\n\n``` js\n{ok, Bedrock} = openai_providers:bedrock(#{profile => <<\"my-profile\">>}),\n{ok, BedrockClient} = openai:new(#{provider => Bedrock}),\ntry\n    {ok, Response} = openai_responses:create(BedrockClient, #{\n        model => <<\"openai.gpt-5.4\">>,\n        input => <<\"Say hello!\">>\n    }),\n    io:format(\"~ts~n\", [openai_response:output_text(Response)])\nafter\n    ok = openai:close(BedrockClient)\nend.\n```\n\nSupported modes include supplied bearer credentials, SigV4 static/callback\ncredentials and native AWS discovery subsets. Executable credential discovery\nand AssumeRole MFA remain unsupported. AWS controls endpoint/model availability.\nRouting/credentials belong inside the factory, not top-level `api_key`/` base_url`.\nSee [provider limits](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md#http-providers) and [examples](https://github.com/scalicon/openai-erlang/blob/0.1.0/examples/providers.erl).\n\nThe SDK follows the request and response behavior of the official\nOpenAI Python SDK **3.52.0**, pinned to\n[`311924f055110122991cc23b988a1836793551a1`](https://github.com/openai/openai-python/tree/311924f055110122991cc23b988a1836793551a1).\n\nVerification combines local integration tests, comparisons against the pinned SDK, and live end-to-end requests through the public Erlang API. Live checks compare requests and results with curl and the official Python SDK; offline comparisons also check how the clients process the same captured responses.\n\nPaired examples preserve reference request data. Erlang tuples, JSON maps, process concurrency and explicit resource ownership provide the corresponding Erlang interface. Intentional differences are documented.\n\nLive coverage varies by operation and mode. Some scenarios remain unverified because they require additional permissions, cloud infrastructure or available services. Local tests and constructor checks are recorded separately from live end-to-end results.\n\nSee the [API mapping](https://github.com/scalicon/openai-erlang/blob/main/docs/PYTHON-ERLANG-API-MAPPING.md),\n[API reference](https://github.com/scalicon/openai-erlang/blob/main/docs/API.md), [public helpers](https://github.com/scalicon/openai-erlang/blob/main/docs/HELPERS.md) and [contracts](https://github.com/scalicon/openai-erlang/blob/main/docs/CONTRACTS.md)\nfor supported behavior, intentional differences and known limitations.\n\nVersion 0.1.0 is the planned first Hex release; public API changes are still possible before release. Inspect the loaded OTP application version with:\n\n```\napplication:get_key(openai, vsn).\n```\n\nSource checkouts derive their version from Git; that is not a published Hex release. Endpoint availability and model access are controlled by OpenAI.\n\nErlang/OTP 27 or later, including the built-in `json` module. The CI matrix is\nOTP 27/28/29. The SDK repository's development commands use rebar3.\n\nScalicon maintains this library and is committed to reviewing bug reports and\npull requests. Please use [GitHub Issues](https://github.com/scalicon/openai-erlang/issues)\nto report bugs or request features, and submit\n[pull requests](https://github.com/scalicon/openai-erlang/pulls) for proposed\nimprovements. See the [contribution guide](https://github.com/scalicon/openai-erlang/blob/main/docs/CONTRIBUTING.md) for reporting,\ndevelopment and review guidelines.\n\nRun local build commands from the root of the repository checkout.\n\nBuild and run local checks without an OpenAI key:\n\n```\nrebar3 compile\nrebar3 fmt --check\nrebar3 as test do compile,xref,dialyzer\nrebar3 as test ct\n```\n\nUse `rebar3 fmt` for formatting. `rebar3 coverage` runs EUnit, Common Test and\ncover reporting; see [transport/build details](https://github.com/scalicon/openai-erlang/blob/main/docs/TRANSPORT.md).\nKeep API docs, mappings and runnable examples in sync with API changes.\nExternal reference checkouts/comparisons belong in ignored `_checkout/`;\nordinary SDK builds/tests do not require Python.\n\nApache-2.0. See [LICENSE.md](https://github.com/scalicon/openai-erlang/blob/0.1.0/LICENSE.md).", "url": "https://wpnews.pro/news/openai-erlang-sdk-native-openai-api-integration-for-erlang-otp", "canonical_source": "https://github.com/scalicon/openai-erlang", "published_at": "2026-12-03 11:22:06+00:00", "updated_at": "2026-12-03 11:48:39.033557+00:00", "lang": "en", "topics": ["developer-tools", "ai-products", "large-language-models"], "entities": ["Scalicon", "SCALICON INC.", "openai_erlang", "OpenAI", "Erlang/OTP", "Hex", "rebar3", "Erlang.mk"], "also_reported_by": [], "takeaway": "Erlang/OTP developers can add the openai_erlang 0.1.0 dependency (module prefix openai) and call openai_responses:create/2 for Responses, Chat Completions, streaming, structured outputs and tool calling, but must build from a local checkout until the Hex package is published.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/openai-erlang-sdk-native-openai-api-integration-for-erlang-otp", "markdown": "https://wpnews.pro/news/openai-erlang-sdk-native-openai-api-integration-for-erlang-otp.md", "text": "https://wpnews.pro/news/openai-erlang-sdk-native-openai-api-integration-for-erlang-otp.txt", "jsonld": "https://wpnews.pro/news/openai-erlang-sdk-native-openai-api-integration-for-erlang-otp.jsonld"}}