Skip to main content
Fireworks AI runs open models like GLM, Kimi, DeepSeek and MiniMax on fast serverless inference. Its API is OpenAI compatible, so any OpenAI SDK can talk to it by changing the base URL. This guide connects the two. Anchor gives your agent a real cloud browser, and a Fireworks model decides what to do in it through tool calls. By the end you’ll have an agent that opens GitHub Trending in an Anchor session and returns the top five repositories.

Prerequisites

In Fireworks, open Settings, then API Keys, and click Create API Key.
The API Keys page in Fireworks settings, with the Create API Key button outlined.

Setup

  1. Set your API keys:
  1. Install dependencies:
You don’t need to run playwright install. The browser runs in Anchor, and Playwright only connects to it over CDP.

Quick example: a Fireworks agent in an Anchor browser

The script below:
  1. Creates an Anchor session with a 5 minute limit.
  2. Connects Playwright to it over CDP.
  3. Gives a Fireworks model two tools, goto and get_text, and lets it call them until it has an answer, for up to 8 steps.
  4. Ends the session, even if something fails along the way.
It uses accounts/fireworks/models/glm-5p3-flash by default. Set FIREWORKS_MODEL to try another model with function calling, such as accounts/fireworks/models/kimi-k3p1-pro, accounts/fireworks/models/deepseek-v4p1-flash-1017 or accounts/fireworks/models/minimax-m3.
Run it:
The TypeScript file uses top-level await, which needs "type": "module" in your package.json. The install step sets it with npm pkg set type=module.

Expected output

The whole run takes about 10 seconds. You’ll get a different session ID, and the repositories will change as Trending updates. This output is from the Python script. The TypeScript script prints the tool arguments as JSON, for example goto({"url":"https://github.com/trending"}). This is the page the model was reading in the Anchor session:
The GitHub Trending page open in an Anchor cloud browser session, with the repositories list that the Fireworks model read.

Use Fireworks with Anchor’s built-in agent (BYOK)

If you’d rather not write the agent loop yourself, Anchor’s perform-web-task agent can run on your Fireworks key through Bring Your Own Keys.
  1. In the Anchor dashboard, open Project Settings, scroll to BYOK and click Add Key.
  2. Pick Custom / OpenAI-compatible, name the key fireworks, paste your Fireworks API key and set the base URL to https://api.fireworks.ai/inference/v1.
  3. Click Verify & Save. Anchor makes a live test call before it stores the key.
Then pass the key name and a Fireworks model on the request:
byok_web_task.py
provider is optional. If you send it, it has to be custom to match the stored key, otherwise Anchor rejects the request. The current SDKs don’t have a key_slug parameter yet, so this example calls the REST API directly. The task leaves its browser session running when it finishes, so the example ends it using the sessionId from the response. Expected output:
LLM calls for this task go straight to Fireworks on your key. Anchor bills browser usage plus a flat per-step fee for BYOK. We’ve run this with glm-5p3-flash, deepseek-v4p1-flash-1017 and minimax-m3. Token usage for each model shows up in Fireworks under Analytics, on the Serverless tab.
The Serverless Usage chart in Fireworks Analytics for Nov 30, with a tooltip that lists tokens used by glm-5p3-flash, kimi-k3p1-pro, deepseek-v4p1-flash-1017 and minimax-m3.

Next steps