danielwaichcesl /
queue
⚡ Ultra-lightweight and predictable queue engine in Go — built for thousands of sequential queues with minimal client impact.
34/100 healthLoading repository data…
rmay1er / repository
Ultra-lightweight Go client for Replicate API — dependency-free (uses only net/http), powered by Go generics for type-safe, flexible model interactions. Simple, fast, and perfect for AI image/text generation! 🚀
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A maximally simple and fast Go library for generating AI images using Replicate's models. Built with standard net/http and leveraging Go's new generics. Dependency-free, using only basic dependencies. No complex setup, just simple and clean code.
For the Russian version of this README, see the README 🇷🇺.
Want to add memory to your AI conversations? Try Magic Memory Box Go — a universal memory library that integrates seamlessly with any AI service, including Reptiloid!
Check out the memory chatbot example to see it in action.
go get github.com/rmay1er/reptiloid-go
export GOEXPERIMENT=jsonv2
Create a .env file in your project:
REPLICATE_API_TOKEN=your_token_here
Create main.go:
package main
import (
"fmt"
"os"
"github.com/joho/godotenv"
"github.com/rmay1er/reptiloid-go/reptiloid"
"github.com/rmay1er/reptiloid-go/reptiloid/models/image" //For image models
"github.com/rmay1er/reptiloid-go/reptiloid/models/text" //For text models
)
func main() {
// Load environment variables
godotenv.Load()
// Get your API token
apiKey := os.Getenv("REPLICATE_API_TOKEN")
// Choose a preinstalled model (FluxSchnell for fast generation)
model := &image.FluxSchnell
// Create the client with model
client := replicate.NewClient(model, apiKey)
// Describe your image with sepicial input for model
input := &models.FluxSchnellInput{
Prompt: "A cute robot playing guitar in the park",
}
// Generate the image with client and your input
result, err := client.Generate(input)
if err != nil {
fmt.Printf("Oops! Something went wrong: %v\n", err)
return
}
// Your image is ready!
fmt.Printf("Image generated: %s\n", result.Output[0])
}
Run it:
go run main.go
/*
GPT-5 Nano is a lightweight variant suitable for fast and cost-effective text tasks, with limited reasoning capabilities.
GPT-5 Mini is a balanced model offering better performance and reasoning, slightly more expensive and slower than Nano.
GPT-5 is the full model designed for high reasoning effort and complex text understanding, typically more resource-intensive.
*/
var (
GPT5nano = reptiloid.NewReplicateModel[GPT5SeriesInput]("openai/gpt-5-nano")
GPT5mini = reptiloid.NewReplicateModel[GPT5SeriesInput]("openai/gpt-5-mini")
GPT5 = reptiloid.NewReplicateModel[GPT5SeriesInput]("openai/gpt-5")
)
/*
GPT-4.1 Nano is a lightweight variant of GPT-4.1 for fast and cost-effective text tasks.
GPT-4.1 Mini is a balanced model of GPT-4.1 offering better performance and reasoning.
GPT-4.1 is the full GPT-4.1 model with advanced configurable parameters.
*/
var (
GPT41nano = reptiloid.NewReplicateModel[GPT4SeriesInput]("openai/gpt-4.1-nano")
GPT41mini = reptiloid.NewReplicateModel[GPT4SeriesInput]("openai/gpt-4.1-mini")
GPT41 = reptiloid.NewReplicateModel[GPT4SeriesInput]("openai/gpt-4.1")
GPT4o = reptiloid.NewReplicateModel[GPT4SeriesInput]("openai/gpt-4o")
GPT4oMini = reptiloid.NewReplicateModel[GPT4SeriesInput]("openai/gpt-4o-mini")
)
/*
DeepSeekR1 is the thoughtful, reasoning-capable model of the DeepSeek family.
It excels at understanding complex prompts and generating insightful responses.
DeepSeekV3 is a newer variant optimized for diverse text tasks with improved performance and versatility.
*/
var (
DeepSeekR1 = reptiloid.NewReplicateModel[DeepSeekInput]("deepseek-ai/deepseek-r1")
DeepSeekV3 = reptiloid.NewReplicateModel[DeepSeekInput]("deepseek-ai/deepseek-v3")
)
/*
FluxSchnell and FluxDev are two models provided for image generation:
- FluxSchnell is a fast model optimized for quick generation.
- FluxDev is better suited for images containing text, though it is slightly more expensive and slower.
*/
var (
FluxSchnell = reptiloid.NewReplicateModel[FluxSchnellInput]("black-forest-labs/flux-schnell")
FluxDev = reptiloid.NewReplicateModel[FluxDevInput]("black-forest-labs/flux-dev")
FluxUltra = reptiloid.NewReplicateModel[FluxUltraInput]("black-forest-labs/flux-1.1-pro-ultra")
FluxPro = reptiloid.NewReplicateModel[FluxProInput]("black-forest-labs/flux-1.1-pro")
)
The library returns a URL where your image is stored. You can download it or share it directly.
Check Replicate's pricing. Most images cost a few cents.
Want to use a different Replicate model? First, find the model you need on Replicate's website. Go to the model's page and look for its schema description, which typically includes the input parameters in JSON format. This schema shows what fields the model expects, like prompts, settings, or other options.
Once you have the JSON schema, you can easily convert it to a Go struct. Simply copy the schema and paste it into a tool like Cursor (an AI-powered code editor) or another AI assistant (such as an AI coding tool), and it will automatically rewrite the JSON schema into a valid Go struct with the appropriate fields and JSON tags.
Here is an example of a custom input struct MyInput that includes a prompt, a system prompt, and some typical neural network settings like guidance scale and number of inference steps:
type MyInput struct {
Prompt string `json:"prompt"`
SystemPrompt string `json:"system_prompt,omitempty"`
Guidance float64 `json:"guidance_scale,omitempty"`
Steps int `json:"num_inference_steps,omitempty"`
}
var MyNewModel = replicate.NewReplicateModel[MyInput]("username/model-name")
go test ./...
Found a bug? Have an idea? We'd love your help!
MIT License - feel free to use this code for your projects!
Made with ❤️ for Go beginners exploring AI image generation
Selected from shared topics, language and repository description—not editorial ratings.
danielwaichcesl /
⚡ Ultra-lightweight and predictable queue engine in Go — built for thousands of sequential queues with minimal client impact.
34/100 health