ExAtlas.Providers.RunPod.Client (ExAtlas v0.5.0)

Copy Markdown View Source

Shared Req client factories for RunPod's three APIs:

  • REST management — https://rest.runpod.io/v1 — pods, endpoints, templates, network volumes, container registry auth, billing.
  • Serverless runtime — https://api.runpod.ai/v2/<endpoint> — job submission, status polling, streaming.
  • Legacy GraphQL — https://api.runpod.io/graphql — GPU pricing catalog (not exposed in REST).

Each factory returns a Req.Request.t() pre-configured with authentication, JSON codec, retry policy, and telemetry. Consumers compose further via Req.merge/2 or pass extra options per call.

Summary

Functions

Build a Req client for the legacy GraphQL API.

GraphQL endpoint URL.

Normalize a Req result into {:ok, body} | {:error, ExAtlas.Error.t()}.

Build a Req client for the REST management API.

Base URL for the REST management API.

Build a Req client for the serverless runtime API, scoped to an endpoint id.

Base URL for the serverless runtime API.

Functions

graphql(ctx)

@spec graphql(ExAtlas.Provider.ctx()) :: Req.Request.t()

Build a Req client for the legacy GraphQL API.

GraphQL uses ?api_key= as a query param, not a header.

graphql_url()

GraphQL endpoint URL.

handle_response(result, expected \\ 200..299)

@spec handle_response(
  {:ok, Req.Response.t()} | {:error, term()},
  integer() | Range.t()
) ::
  {:ok, term()} | {:error, ExAtlas.Error.t()}

Normalize a Req result into {:ok, body} | {:error, ExAtlas.Error.t()}.

Accepts the {:ok, %Req.Response{}} | {:error, exception} returned by Req.

management(ctx)

@spec management(ExAtlas.Provider.ctx()) :: Req.Request.t()

Build a Req client for the REST management API.

Uses Authorization: Bearer <key>. Applies :retry :transient and a 30s receive timeout. Extra options in ctx.req_options are merged in last and win.

management_url()

Base URL for the REST management API.

runtime(ctx, endpoint_id)

@spec runtime(ExAtlas.Provider.ctx(), String.t()) :: Req.Request.t()

Build a Req client for the serverless runtime API, scoped to an endpoint id.

Example: runtime(ctx, "abc123") talks to https://api.runpod.ai/v2/abc123.

runtime_url()

Base URL for the serverless runtime API.