Skip to main content
This guide covers the move of @outputai/http into @outputai/core. The package is no longer published: its API now lives at @outputai/core/http, with the same exports and behavior. Two smaller breaks come with it: ky and undici are now peer dependencies of @outputai/core, and sendHttpRequest() parses some response bodies differently.

What changed

  • @outputai/http is replaced by the @outputai/core/http subpath. outputFetch, createKyClient, addRequestCost, and the ky and undici re-exports are unchanged.
  • @outputai/output no longer depends on @outputai/http.
  • ky (>=2 <3) and undici (>=8 <9) are peer dependencies of @outputai/core.
  • Tracing.Attribute.HTTPRequestCount and Tracing.Attribute.HTTPRequestCost moved from @outputai/core/sdk/runtime to @outputai/core/http as HTTPRequestCount and HTTPRequestCost. The http:request:count and http:request:cost trace attributes are unchanged.
  • sendHttpRequest() returns XML, form-urlencoded, and JavaScript response bodies as text instead of base64, and returns empty or invalid JSON bodies as raw text instead of throwing.
  • With OUTPUT_TRACE_HTTP_VERBOSE on, HTTP request and response bodies in trace files are parsed the same way as sendHttpRequest(). Multipart bodies are stored as base64.

Migration steps

Update imports

Replace every import of @outputai/http with @outputai/core/http, including module mocks in tests:

Remove the dependency

Delete @outputai/http from dependencies, devDependencies, and peerDependencies in package.json. If your project depends on @outputai/core directly rather than through @outputai/output, bump it to 0.16.0.

Install the peer dependencies

npm 7+ and pnpm install peer dependencies automatically. With other package managers, or if your install reports missing peers, add them yourself:
If your project already depends on ky or undici, make sure the versions fall in the supported ranges.

Update trace attribute imports

Code that referenced Tracing.Attribute.HTTPRequestCount or Tracing.Attribute.HTTPRequestCost should import them from @outputai/core/http:
To attach a cost to an HTTP request, keep using addRequestCost() from @outputai/core/http.

Re-check sendHttpRequest() response bodies

This only affects calls with responseOptions.includeBody: true: Remove any base64 decoding of those content types. If you relied on the error to detect a bad JSON response, check whether body is a string instead.

Re-check trace file readers

If you parse trace files recorded with OUTPUT_TRACE_HTTP_VERBOSE on, request and response bodies now follow the table above, and multipart request bodies are base64 strings.