Chatoyant_native.HttpSourcetype body = | Empty| Text of string| Json of Chatoyant_runtime.Json.t| Multipart of multipart_part listHuman-readable HTTP error rendering for app/tool handlers.
module type EFFECT =
Chatoyant_runtime.Effect.HTTP
with type multipart_part = multipart_part
and type body = body
and type request = request
and type response = response
and type error = errorHTTP effect module with types tied to Chatoyant.Http.
type client_certificate = {certificate_pem : string;private_key_pem : string;authenticator : X509.Authenticator.t option;}PEM-encoded client certificate chain and private key for mTLS provider endpoints. When authenticator is omitted, system trust roots are used for server verification.
type https = | SystemUse system trust roots through ca-certs and verify HTTPS hosts.
| Authenticator of X509.Authenticator.tBuild a TLS client from a caller-supplied X.509 authenticator.
*)| Mutual_tls of client_certificateUse system/server authentication plus a PEM client certificate.
*)| Tls_config of Tls.Config.clientUse an already constructed TLS client config.
*)| DisabledDisable HTTPS. Plain HTTP URLs still work; HTTPS URLs fail fast.
*)Default response body limit, currently 100 MiB.
val tls_config :
?authenticator:X509.Authenticator.t ->
unit ->
(Tls.Config.client, string) resultBuild the TLS client config used by System and Authenticator.
val mtls_config :
?authenticator:X509.Authenticator.t ->
certificate_pem:string ->
private_key_pem:string ->
unit ->
(Tls.Config.client, string) resultBuild a TLS client config with a PEM certificate chain/private key for mTLS endpoints such as xAI enterprise deployments.
val make :
?https:https ->
?max_response_size:int ->
net:_ Eio.Net.t ->
clock:_ Eio.Time.clock ->
unit ->
(module EFFECT)make ~net ~clock () creates a Chatoyant HTTP effect backed by cohttp-eio.
Multipart bodies are encoded at this boundary, JSON bodies receive a default content-type: application/json header when absent, and timeout_ms is enforced with Eio.Time.with_timeout.
val send :
?https:https ->
?max_response_size:int ->
net:_ Eio.Net.t ->
clock:_ Eio.Time.clock ->
request ->
(response, error) resultOne-shot HTTP request helper for Eio-native app/tool code. For provider clients that issue many requests, prefer make and reuse the returned effect module.
val get :
?https:https ->
?max_response_size:int ->
?headers:(string * string) list ->
?timeout_ms:int ->
net:_ Eio.Net.t ->
clock:_ Eio.Time.clock ->
string ->
(response, error) resultConvenience GET helper.
val get_json :
?https:https ->
?max_response_size:int ->
?headers:(string * string) list ->
?timeout_ms:int ->
net:_ Eio.Net.t ->
clock:_ Eio.Time.clock ->
string ->
(Chatoyant_runtime.Json.t, error) resultConvenience GET helper that parses a successful response body as JSON.
val post_json :
?https:https ->
?max_response_size:int ->
?headers:(string * string) list ->
?timeout_ms:int ->
net:_ Eio.Net.t ->
clock:_ Eio.Time.clock ->
string ->
Chatoyant_runtime.Json.t ->
(response, error) resultConvenience JSON POST helper.