> ## Documentation Index
> Fetch the complete documentation index at: https://docs.output.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# v0.15.0 → v0.16.0

> Upgrading Output.ai projects from v0.15.0 to v0.16.0: @outputai/http is folded into @outputai/core, ky and undici become peer dependencies, and sendHttpRequest() parses more response bodies as text.

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:

```ts theme={null}
// Before
import { createKyClient, addRequestCost } from '@outputai/http';
vi.mock( '@outputai/http', () => ( { outputFetch: vi.fn() } ) );

// After
import { createKyClient, addRequestCost } from '@outputai/core/http';
vi.mock( '@outputai/core/http', () => ( { outputFetch: vi.fn() } ) );
```

### 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:

```bash theme={null}
npm install ky@2 undici@8
```

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`:

```ts theme={null}
// Before
import { Tracing } from '@outputai/core/sdk/runtime';
const isCost = attribute instanceof Tracing.Attribute.HTTPRequestCost;

// After
import { HTTPRequestCost } from '@outputai/core/http';
const isCost = attribute instanceof HTTPRequestCost;
```

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`:

| Response | Before | After |
| - | - | - |
| `application/xml`, `*+xml` | base64 string | text |
| `application/x-www-form-urlencoded` | base64 string | text |
| `application/javascript` | base64 string | text |
| JSON content type with an empty body | throws | `''` |
| JSON content type with an invalid body | throws | raw text |

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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.