Cloud
Run larger, more powerful models with WebInfer Cloud
Preview
Cloud Models
WebInfer's cloud models are a new kind of model that can run without a powerful GPU. Instead, cloud models are automatically offloaded to WebInfer's cloud service while offering the same capabilities as local models, making it possible to keep using your local tools while running larger models that wouldn't fit on a personal computer.
Supported models
For a list of supported models, see WebInfer's model library.
Running Cloud models
WebInfer's cloud models require an account on webinfer.dev. To sign in or create an account, visit the sign in page.
First, install WebInfer's JavaScript library:
npm i webinferThen use the library to run a cloud model:
import { streamText } from "webinfer"const response = await streamText({ model: "gpt-4o-mini", messages: [{ role: "user", content: "Explain quantum computing" }],})for await (const chunk of response.textStream) { process.stdout.write(chunk)}Cloud API access
Cloud models can also be accessed directly via WebInfer's API. In this mode, webinfer.dev acts as a remote host.
Authentication
For direct access to WebInfer's API, first create an API key.
Then, set the WEBLLM_API_KEY environment variable to your API key:
export WEBLLM_API_KEY=your_api_keyListing models
Models available via WebInfer's API can be listed via:
curl https://api.webinfer.dev/v1/models \ -H "Authorization: Bearer $WEBLLM_API_KEY"Generating a response
First, install WebInfer's JavaScript library:
npm i webinferNext, make a request to the model:
import { WebInferClient } from "webinfer"const client = new WebInferClient({ baseUrl: "https://api.webinfer.dev", apiKey: process.env.WEBLLM_API_KEY,})const response = await client.streamText({ model: "gpt-4o-mini", messages: [{ role: "user", content: "Explain quantum computing" }],})for await (const chunk of response.textStream) { process.stdout.write(chunk)}OAuth for Third-Party Apps
Allow users to connect their WebInfer Cloud accounts to your application using OAuth. This enables your app to use AI features on behalf of users, charged to their account.
How it works
WebInfer implements a standard OAuth 2.0 authorization code flow with domain-based authorization:
- User initiates connection - Your app calls
connectCloud()to start the OAuth flow - User authorizes - A popup opens where the user logs in and grants permission
- Token issued - Your app receives access and refresh tokens bound to your domain
- Use AI features - All subsequent AI requests automatically use the user's credentials
Quick integration
The easiest way to add OAuth is with the useCloudAuth hook:
import { useCloudAuth } from '@webinfer/client'function CloudConnectButton() { const { connected, loading, connect, disconnect, error } = useCloudAuth() if (connected) { return ( <button onClick={() => disconnect({ revokeToken: true })}> Disconnect Cloud </button> ) } return ( <> <button onClick={() => connect()} disabled={loading}> {loading ? 'Connecting...' : 'Connect WebInfer Cloud'} </button> {error && <p className="error">{error.message}</p>} </> )}With or without app registration
OAuth works in two modes:
- Without registration - Just call
connectCloud(). Users see your domain (e.g., "yourapp.com") during authorization. The client SDK handles token storage automatically. - With registration - Register an app to get a client ID. Users see your app name and logo. You get a developer dashboard with usage stats and can configure allowed domains.
When to register an app
Register an OAuth app if you want:
- Branding - Show your app name and logo instead of just the domain
- Analytics - See usage stats, authorized users, and request logs
- Domain restrictions - Control which domains can use your client ID
- Custom redirect URIs - Use specific callback URLs for server-side flows
How to register
- Go to OAuth Applications in your account settings
- Click "Create App" and enter a name
- Copy your Client ID - this identifies your app
- Save your Client Secret securely (only shown once) - used for server-side token exchange
- Optionally configure redirect URIs and allowed origins in the edit dialog
Domain Authorization
https://yourapp.com cannot be used from https://malicious.com.Custom OAuth configuration
Use connectCloud() directly for more control:
import { connectCloud } from '@webinfer/client'const result = await connectCloud({ // Your registered client ID clientId: 'webinfer_your_app_id', // Requested permission scopes scopes: ['inference', 'inference:image'], // OAuth callback URL (must be registered) redirectUri: 'https://yourapp.com/oauth/callback', // Use popup (true) or redirect (false) flow usePopup: true,})console.log('Granted scopes:', result.scopes)console.log('Token expires:', new Date(result.expiresAt))OAuth scopes
Request only the scopes your app needs:
| Scope | Description |
|---|---|
inference | Full inference access (text, image, audio) |
inference:text | Text generation only |
inference:image | Image generation only |
Token lifecycle
WebInfer uses secure, rotating tokens:
- Access tokens - Short-lived (1 hour), auto-refreshed 5 minutes before expiry
- Refresh tokens - Long-lived (90 days), single-use with rotation
- Domain binding - Tokens only work from the authorized origin
Check connection status programmatically:
import { getCloudConnectionStatus, isCloudConnected } from '@webinfer/client'// Simple checkif (isCloudConnected()) { console.log('User has connected their cloud account')}// Detailed statusconst status = getCloudConnectionStatus()if (status.connected) { console.log('Gateway:', status.gatewayUrl) console.log('Scopes:', status.scopes) console.log('Expires:', new Date(status.expiresAt)) console.log('Is expired:', status.isExpired)}Using AI after authentication
Once connected, AI functions automatically use the user's cloud credentials:
import { generateText, isCloudConnected } from '@webinfer/client'async function generateResponse(prompt: string) { if (!isCloudConnected()) { throw new Error('Please connect your WebInfer Cloud account first') } // Automatically uses user's cloud credentials and credits const result = await generateText({ model: 'gpt-4o-mini', prompt, }) return result.text}Interactive demo
See the full OAuth flow in action with our interactive demo, which includes live code examples and token status visualization.
Pricing
WebInfer Cloud uses a credit-based pricing model. See the Cloud pricing page for details on plans and usage limits.
Next Steps
- Cloud Pricing - View plans and pricing
- API Keys - Create API keys for cloud access
- OAuth Applications - Register your OAuth app
- Interactive Demos - Try the OAuth flow live
- Credits - View your credit balance and usage
- API Reference - Full API documentation