Quickstart
Deploy your first edge function in under 60 seconds.
# Install the CLI
npm install -g @bijani/cli
# Log in to your account
bijani login
# Create a new project
bijani init my-project
cd my-project
# Deploy to production
bijani deploy
npm install -g @bijani/cli
# Log in to your account
bijani login
# Create a new project
bijani init my-project
cd my-project
# Deploy to production
bijani deploy
Installation
The Bijani CLI is available via npm, Homebrew, and as a standalone binary.
# npm
npm install -g @bijani/cli
# Homebrew (macOS / Linux)
brew install bijani/tap/cli
# Standalone binary
curl -fsSL https://bijani.space/install.sh | sh
npm install -g @bijani/cli
# Homebrew (macOS / Linux)
brew install bijani/tap/cli
# Standalone binary
curl -fsSL https://bijani.space/install.sh | sh
Authentication
Authenticate using an API token or OAuth. Generate tokens from the dashboard.
# Set your API token as an environment variable
export BIJANI_API_TOKEN="bijan_xxxxxxxxxxxx"
# Or pass it directly to the CLI
bijani deploy --token "bijan_xxxxxxxxxxxx"
export BIJANI_API_TOKEN="bijan_xxxxxxxxxxxx"
# Or pass it directly to the CLI
bijani deploy --token "bijan_xxxxxxxxxxxx"
Creating Edge Functions
Write functions in JavaScript, TypeScript, Python, Rust, or Go.
// functions/api/hello.js
export default {
async fetch(request, env) {
const data = await request.json();
return Response.json({
message: `Hello, ${data.name || 'world'}`,
region: request.cf.colo
});
}
};
export default {
async fetch(request, env) {
const data = await request.json();
return Response.json({
message: `Hello, ${data.name || 'world'}`,
region: request.cf.colo
});
}
};
Loading AI Models
Load and run inference on state-of-the-art models with a single API call.
import { Bijani } from "@bijani/sdk";
const model = await bijani.models.load("llama-3-8b", {
quantization: "int8",
maxContextLength: 4096
});
const model = await bijani.models.load("llama-3-8b", {
quantization: "int8",
maxContextLength: 4096
});
Text Generation
Generate text with streaming support for real-time applications.
const stream = await model.generateStream({
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Write a haiku about infrastructure." }
],
temperature: 0.7,
maxTokens: 50
});
for await (const chunk of stream) {
process.stdout.write(chunk);
}
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Write a haiku about infrastructure." }
],
temperature: 0.7,
maxTokens: 50
});
for await (const chunk of stream) {
process.stdout.write(chunk);
}
REST API
All Bijani services are accessible via a consistent REST API.
# Deploy a function
curl -X POST https://api.bijani.space/v1/functions \
-H "Authorization: Bearer $BIJANI_API_TOKEN" \
-H "Content-Type: application/javascript" \
--data-binary "@function.js"
# Run inference
curl -X POST https://api.bijani.space/v1/inference/llama-3-8b \
-H "Authorization: Bearer $BIJANI_API_TOKEN" \
-d '{"prompt":"Hello world","max_tokens":100}'
curl -X POST https://api.bijani.space/v1/functions \
-H "Authorization: Bearer $BIJANI_API_TOKEN" \
-H "Content-Type: application/javascript" \
--data-binary "@function.js"
# Run inference
curl -X POST https://api.bijani.space/v1/inference/llama-3-8b \
-H "Authorization: Bearer $BIJANI_API_TOKEN" \
-d '{"prompt":"Hello world","max_tokens":100}'
CLI Reference
The Bijani CLI provides a complete interface for managing your infrastructure.
bijani deploy # Deploy current project
bijani logs # Stream function logs
bijani list # List deployed functions
bijani env set # Set environment variables
bijani models list # List available AI models
bijani vectors create # Create a vector index
bijani status # Show deployment status
bijani logs # Stream function logs
bijani list # List deployed functions
bijani env set # Set environment variables
bijani models list # List available AI models
bijani vectors create # Create a vector index
bijani status # Show deployment status