All Plugins

xAI (Grok)

AI

AI text generation and vision analysis with xAI's Grok models. Structured JSON output and image understanding.

xAI (Grok) example
Powered by xAI

Grok AI models from xAI. This plugin passes your configuration directly—no abstraction layer.

Installation

npm install @teamflojo/floimg-xai

Quick Start

import createClient from "@teamflojo/floimg";
import { grokText, grokVision } from "@teamflojo/floimg-xai";

const floimg = createClient();
floimg.registerTextProvider(grokText());
floimg.registerVisionProvider(grokVision());

// Generate text
const result = await floimg.generateText({
  provider: "grok-text",
  params: {
    prompt: "Write 3 creative image prompts for a cyberpunk cityscape"
  }
});

// Analyze an image
const analysis = await floimg.analyzeImage({
  provider: "grok-vision",
  blob: image,
  params: { prompt: "Describe this image in detail" }
});

API Reference

Parameter Type Required Description
prompt string Yes Text prompt for generation or analysis
systemPrompt string No System prompt to guide behavior
outputFormat "text" | "json" No Output format (default: text)
jsonSchema object No JSON schema for structured output
temperature number No Creativity 0-2 (default: 0.7)

Examples

Generate Prompts

Generate Prompts

Use Grok to generate image prompts

                      const result = await floimg.generateText({
  provider: "grok-text",
  params: {
    prompt: "Generate creative prompts for a sci-fi scene",
    outputFormat: "json"
  }
});
                    
Analyze Image

Analyze Image

Use Grok Vision to understand images

                      const analysis = await floimg.analyzeImage({
  provider: "grok-vision",
  blob: image,
  params: { prompt: "What product is shown?" }
});
                    

Improve This Plugin

Found a bug? Have a feature request? Contributions are welcome!

View on GitHub