Liking cljdoc? Tell your friends :D

llm.sdk.providers.openai.chat

OpenAI Chat Completions transport adapter. Covers OpenAI, OpenRouter, DeepSeek, and other OpenAI-compatible providers.

OpenAI Chat Completions transport adapter.
Covers OpenAI, OpenRouter, DeepSeek, and other OpenAI-compatible providers.
raw docstring

azure-url-builderclj

(azure-url-builder profile _request path)

URL builder for Azure OpenAI deployments. Composes {base-url}/openai/deployments/{deployment}{path}?api-version=... Reads :azure/deployment and :azure/api-version off the profile.

URL builder for Azure OpenAI deployments. Composes
  {base-url}/openai/deployments/{deployment}{path}?api-version=...
Reads :azure/deployment and :azure/api-version off the profile.
sourceraw docstring

build-alias-profileclj

(build-alias-profile spec)

Construct an OpenAI-compat provider profile from a spec map.

Spec keys: :id required, e.g. :mistral :base-url required, e.g. "https://api.mistral.ai/v1" :env-var-names vector of env-var name strings :auth-strategy defaults :bearer :auth-header-name only with :api-key-header :default-headers optional map :capabilities defaults #{:chat :streaming :tools} :quirks optional map: :drops #{:k1 :k2} strip body keys :thinking-explicit send :thinking dict :supports-model-listing? defaults true :supported-params optional set (carried as :profile/supported-params enforces drop+warn)

Construct an OpenAI-compat provider profile from a spec map.

Spec keys:
  :id                       required, e.g. :mistral
  :base-url                 required, e.g. "https://api.mistral.ai/v1"
  :env-var-names            vector of env-var name strings
  :auth-strategy            defaults :bearer
  :auth-header-name         only with :api-key-header
  :default-headers          optional map
  :capabilities             defaults #{:chat :streaming :tools}
  :quirks                   optional map:
                              :drops #{:k1 :k2}   strip body keys
                              :thinking-explicit  send :thinking dict
  :supports-model-listing?  defaults true
  :supported-params         optional set (carried as
                              :profile/supported-params
                              enforces drop+warn)
sourceraw docstring

build-request-openaiclj

(build-request-openai profile request)
source

make-transportclj

(make-transport)
source

parse-error-openaiclj

(parse-error-openai profile status body)
source

parse-response-openaiclj

(parse-response-openai profile raw)
source

parse-stream-event-openaiclj

(parse-stream-event-openai profile line)
source

register-alias!clj

(register-alias! spec)

Register an OpenAI-compat alias profile in one call.

Register an OpenAI-compat alias profile in one call.
sourceraw docstring

register-azure-deployment!clj

(register-azure-deployment!
  {:keys [id endpoint deployment api-version env-var-names auth-strategy
          auth-header-name capabilities quirks default-headers]
   :or {auth-strategy :api-key-header
        auth-header-name "api-key"
        capabilities #{:tools :reasoning :chat :json-schema :streaming}
        quirks {}
        default-headers {}}})

Register an Azure OpenAI deployment as a provider profile.

Required: :id keyword id for the profile (e.g. :azure-gpt4o-prod) :endpoint base URL, e.g. "https://my-rg.openai.azure.com" (no trailing slash, no /openai/deployments/...) :deployment the deployment name configured in the Azure portal :api-version e.g. "2024-08-01-preview"

Optional: :env-var-names vector of env-var names to read the API key from (defaults to ["AZURE_OPENAI_API_KEY"]) :auth-strategy :api-key-header (default) or :bearer (AAD) :auth-header-name defaults to "api-key" (only used with :api-key-header). Set to "Authorization" or pass :auth-strategy :bearer for AAD bearer. :capabilities defaults #{:chat :streaming :tools :json-schema :reasoning} :quirks optional quirks map passed through verbatim :default-headers optional map merged into outgoing headers

Register an Azure OpenAI deployment as a provider profile.

Required:
  :id           keyword id for the profile (e.g. :azure-gpt4o-prod)
  :endpoint     base URL, e.g. "https://my-rg.openai.azure.com"
                (no trailing slash, no /openai/deployments/...)
  :deployment   the deployment name configured in the Azure portal
  :api-version  e.g. "2024-08-01-preview"

Optional:
  :env-var-names      vector of env-var names to read the API key from
                      (defaults to ["AZURE_OPENAI_API_KEY"])
  :auth-strategy      :api-key-header (default) or :bearer (AAD)
  :auth-header-name   defaults to "api-key" (only used with
                      :api-key-header). Set to "Authorization" or
                      pass :auth-strategy :bearer for AAD bearer.
  :capabilities       defaults #{:chat :streaming :tools
                                 :json-schema :reasoning}
  :quirks             optional quirks map passed through verbatim
  :default-headers    optional map merged into outgoing headers
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close