package openrouter_api

  1. Overview
  2. Docs
OCaml client for the OpenRouter API

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1.0.tar.gz
md5=37c701d570788095f9a0690e401a4b0c
sha512=0f6e6d347094aff4efb50330d50ade3f1706929400498998a8d8f409f1ab45099d792cc469210e53c2ca06b0e1a9b20fdf8e89361a52969cc495812092fe584b

doc/openrouter_api/Openrouter_api/Generation/index.html

Module Openrouter_api.GenerationSource

Query generation stats for a previously-issued completion via the GET /api/v1/generation endpoint. The generation id is the same id returned on a chat completion or stream chunk; stats become queryable a few seconds after the request finishes.

Sourcemodule Provider_response : sig ... end
Sourcemodule Stats : sig ... end

Stats for a single generation. Many fields are nullable on the wire; we keep them as options rather than papering over with defaults.

Sourceval get : api_key:string -> ?app_info:Http.App_info.t -> ?on_response_body:(string -> unit Async.Deferred.t) -> id:string -> unit -> Stats.t option Core.Or_error.t Async.Deferred.t

get ~api_key ~id () resolves to Some stats once the generation has been persisted. Returns None if the generation is not yet (or not ever) queryable — the endpoint typically takes a couple of seconds after the completion to materialize.

Sourcemodule For_testing : sig ... end