---
title: "Web client"
description: "The weaviate-client-web package: runs the async Weaviate Python client under Pyodide and connects over gRPC-Web."
url: https://docs.weaviate.io/weaviate/client-libraries/python/web-client
---

# Web client

`weaviate-client-web` runs the async Python client under [Pyodide](https://pyodide.org/), a Python runtime for [WebAssembly](https://webassembly.org/). Use it in browser pages, [marimo](https://marimo.io/) notebooks and [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API), where a plain gRPC connection is not possible.

It has the same API as the [async client](https://docs.weaviate.io/weaviate/client-libraries/python/async). gRPC calls go over gRPC-Web and REST calls go over `fetch`. Weaviate serves gRPC-Web on the REST port, so the client needs only one HTTP(S) endpoint.

The package was first released with client `v4.25.1`. It needs Python 3.11 or later and is tested on Pyodide 314.0.4 (CPython 3.14).

## Install

Install it with `micropip` through the `grpc-web` extra of the base client:

```python
import micropip
await micropip.install("weaviate-client[grpc-web]")
```

The extra only applies under Pyodide, so it installs nothing on regular CPython. Installing `weaviate-client-web` directly also works, and pins `weaviate-client` to the same version. The package only imports under Pyodide.

## Connect to Weaviate

Under Pyodide, `import weaviate` loads the web transport automatically. If the package is missing, the import raises an `ImportError` that names the extra to install.

```python
import weaviate

client = weaviate.use_async_with_local(port=8080)
await client.connect()  # runs the gRPC health check over gRPC-Web

collection = client.collections.use("Article")
response = await collection.query.near_text("hello", limit=3)
```

To connect to Weaviate Cloud:

```python
import weaviate
from weaviate.classes.init import Auth

client = weaviate.use_async_with_weaviate_cloud(
    cluster_url=weaviate_url,
    auth_credentials=Auth.api_key(weaviate_api_key),
)
await client.connect()
```

The connect helpers send gRPC to the REST endpoint, with the same host, port and TLS setting. You cannot change this through the helpers. `use_async_with_custom()` still requires the gRPC arguments. Pass the HTTP values. Any other value is replaced with the HTTP values and a warning is logged.

```python
client = weaviate.use_async_with_custom(
    http_host="localhost", http_port=8080, http_secure=False,
    grpc_host="localhost", grpc_port=8080, grpc_secure=False,  # same as HTTP
)
```

> [!NOTE]
>
> **Added in `v1.38.3`**
>
> Weaviate serves gRPC-Web by default from `v1.38.3`.

The web client needs Weaviate `v1.38.3` or later. For the server side, see [gRPC-Web](https://docs.weaviate.io/weaviate/api/grpc#grpc-web).

## Browser notes

**Only the async client is available.** The sync client does not run under Pyodide.

**Some batching is not available.** gRPC-Web has no bidirectional streaming, so `client.batch.stream()` and `client.batch.experimental()` raise immediately. Use `collection.data.insert_many()` instead. `batch.dynamic()`, `batch.fixed_size()` and `batch.rate_limit()` belong to the sync client only.

**Embedded Weaviate is not supported.** `use_async_with_embedded()` does not work in the browser.

**Some settings are accepted but ignored.** The browser's `fetch` manages connections, so these have no effect:

- `AdditionalConfig.proxies` and proxy environment variables
- Connection pool sizing and `session_pool_max_retries`
- `GrpcConfig.credentials`. The browser trust store decides TLS.
- `GrpcConfig.channel_options`, including the max message length. The server's `grpcMaxMessageSize` is the ceiling. Larger messages fail with `RESOURCE_EXHAUSTED`.

**Provider API keys work in the browser. Other custom headers do not.** Model provider keys passed through `headers`, such as `X-OpenAI-Api-Key`, are on Weaviate's default CORS allow-list, so they work cross-origin out of the box. Any other header fails the browser's CORS preflight unless the operator lists it in [`CORS_ALLOW_HEADERS`](https://docs.weaviate.io/deploy/configuration/env-vars#CORS_ALLOW_HEADERS) on the server. Setting that variable replaces the default list, so include the defaults you still need.

A request blocked by CORS looks like a network failure (`TypeError: Failed to fetch`), and the client retries it.

**Weaviate Cloud needs CORS enabled.** In the Weaviate Cloud console, enable **Allow all CORS origins** in the cluster settings. The change takes a few minutes to apply. Until then, the client fails at its first REST call with a `Failed to fetch` error.

> [!WARNING]
>
> **Browser credentials are visible to the user**
>
> Anyone who opens your page or notebook can read the keys it holds, including Weaviate and model provider API keys. Use a read-only API key with the least [RBAC](https://docs.weaviate.io/deploy/configuration/authorization) permissions the app needs. Never ship an admin key to a browser.
