adk_model_http_client (erlang_adk v0.8.0)
View SourceProvider-neutral construction of bounded JSON model requests.
This module owns no credentials and knows no vendor wire schema. It joins a validated base URL with a fixed adapter-owned path, derives the exact scheme/host allow-list, encodes only a checked JSON map, and invokes an injected adk_model_http_transport. Redirects are always disabled.
Summary
Functions
Resolve a direct adapter key or its conventional environment value. Error terms never contain credential material.
Resolve an environment credential only for the adapter's exact official base URL. A custom HTTPS endpoint must carry an explicit key, which keeps caller-controlled origins from receiving ambient credentials.
Resolve only a key present in this request configuration. This is the credential boundary for OpenAI-compatible endpoints, which have no single official origin to which a process-wide environment key could be bound.
Require HTTPS for a credential-bearing model adapter. The generic transport still supports HTTP for explicitly keyless local integrations; native vendor adapters call this stricter boundary before resolving keys.
Functions
-spec resolve_api_key(map(), string()) -> {ok, binary()} | {error, missing_api_key | invalid_api_key}.
Resolve a direct adapter key or its conventional environment value. Error terms never contain credential material.
-spec resolve_bound_api_key(map(), string(), binary()) -> {ok, binary()} | {error, missing_api_key | invalid_api_key | custom_endpoint_requires_explicit_api_key}.
Resolve an environment credential only for the adapter's exact official base URL. A custom HTTPS endpoint must carry an explicit key, which keeps caller-controlled origins from receiving ambient credentials.
-spec resolve_explicit_api_key(map()) -> {ok, binary()} | {error, missing_api_key | invalid_api_key}.
Resolve only a key present in this request configuration. This is the credential boundary for OpenAI-compatible endpoints, which have no single official origin to which a process-wide environment key could be bound.
-spec stream(map(), binary(), [{binary(), binary()}], map(), adk_model_http_transport:chunk_callback()) -> {ok, adk_model_http_transport:response()} | {error, term()}.
-spec validate_https_base_url(map()) -> ok | {error, invalid_model_https_base_url | invalid_model_base_url}.
Require HTTPS for a credential-bearing model adapter. The generic transport still supports HTTP for explicitly keyless local integrations; native vendor adapters call this stricter boundary before resolving keys.