Add your WebInfer Gateway API key in Settings
Route requests through another WebInfer gateway instance. Enables federated inference across multiple gateway nodes, organization-hosted gateways, or fallback to other resources. Creates a true "web of computing nodes" where gateways can connect to each other.
| Field | Type | Required | Description |
|---|---|---|---|
| gatewayUrl | url | Required | URL of the remote WebInfer gateway server |
| apiKey | password | Optional | Full access API key for server-to-server communication |
| accessToken | password | Optional | Access token for token-gated gateways (with quotas) |
| timeout | number | Optional | Request timeout in milliseconds |
Add provider:
npx webinfer provider add webinfer-server --key YOUR_API_KEYTest connection:
npx webinfer provider test webinfer-serverGet your API key from https://webinfer.com/docs/gateways
Basic usage:
import { generateText } from "webinfer"
// WebInfer automatically routes to the best available provider
const result = await generateText({
prompt: "Write a haiku about programming"
})
console.log(result.text)Specify WebInfer Gateway explicitly:
import { generateText } from "webinfer"
const result = await generateText({
prompt: "Write a haiku about programming",
provider: "webinfer-server"
})
console.log(result.text)
console.log("Provider:", result.provider)
console.log("Model:", result.model)Streaming:
import { streamText } from "webinfer"
const { textStream } = await streamText({
prompt: "Write a story about AI",
provider: "webinfer-server"
})
for await (const chunk of textStream) {
process.stdout.write(chunk)
}