# Run fx on AnyRouter

> Install the AnyRouter provider plugin, set one key, and pass anyrouter() to createFxAgent.

Pass anyrouter() to createFxAgent

**Slug**: `fx`  
**URL**: https://anyrouter.dev/use-cases/fx  
**Markdown**: https://anyrouter.dev/use-cases/fx.md  
**Short link**: https://anyrouter.dev/u/fx  

## Why use this

fx agents need a provider with model metadata. Writing that by hand for every model you want to try is slow, and it goes stale.

## Set it up

1. Install libfx and the plugin from GitHub. The plugin is not on npm.
2. Set ANYROUTER_API_KEY. Get a key at anyrouter.dev.
3. Pass provider: anyrouter() and an AnyRouter model id such as anyrouter/hermes to createFxAgent. Use fetchAnyRouterProvider() for models newer than the bundled list.

## Code

### Install

```bash
npm i libfx github:AnyRouterHQ/fx-provider-anyrouter#v0.1.0
export ANYROUTER_API_KEY=sk-ar-v1-...
```

### createFxAgent

```ts
import { createFxAgent } from "libfx"
import { anyrouter, anyrouterCredentials } from "fx-provider-anyrouter"

const agent = createFxAgent({
  provider: anyrouter(),
  model: "anyrouter/hermes",
  credentials: anyrouterCredentials(),
})
```

## Links

- [fx-provider-anyrouter (plugin)](https://github.com/AnyRouterHQ/fx-provider-anyrouter)
- [fx (Vercel Labs)](https://github.com/vercel-labs/fx)

## Related

- [hermes-agent](https://anyrouter.dev/use-cases/hermes-agent)
- [coding-agents](https://anyrouter.dev/use-cases/coding-agents)
- [claude-agent-sdk](https://anyrouter.dev/use-cases/claude-agent-sdk)
