An unofficial Go SDK for the Reve Image Generation API - a powerful AI platform known for stunning aesthetics, accurate text rendering, and natural-language image edits.
- π¨ Create - Generate images from text descriptions
- βοΈ Edit - Modify images with text instructions
- π Remix - Combine multiple images with prompts
- π Proxy Support - HTTP, HTTPS, SOCKS5 proxies
- π Auto Retry - Exponential backoff with jitter
- π¦ Batch Processing - Concurrent operations
- π° Cost Estimation - Estimate before you spend
go get github.com/shamspias/reve-goRequires Go 1.25+
package main
import (
"context"
"log"
"os"
reve "github.com/shamspias/reve-go"
)
func main() {
client := reve.NewClient(os.Getenv("REVE_API_KEY"))
result, err := client.Images.Create(context.Background(), &reve.CreateParams{
Prompt: "A beautiful mountain landscape at sunset",
})
if err != nil {
log.Fatal(err)
}
result.SaveTo("landscape.png")
log.Printf("Saved! Credits used: %d", result.CreditsUsed)
}// Basic
client := reve.NewClient(apiKey)
// With options
client := reve.NewClient(apiKey,
reve.WithTimeout(60*time.Second),
reve.WithRetry(5, time.Second, 30*time.Second),
reve.WithDebug(true),
)// HTTP Proxy
client := reve.NewClient(apiKey,
reve.WithHTTPProxy("http://proxy:8080"),
)
// SOCKS5 Proxy
client := reve.NewClient(apiKey,
reve.WithSOCKS5Proxy("127.0.0.1:1080", "user", "pass"),
)
// Environment variables (HTTP_PROXY, HTTPS_PROXY)
client := reve.NewClient(apiKey,
reve.WithProxyFromEnvironment(),
)result, err := client.Images.Create(ctx, &reve.CreateParams{
Prompt: "A cyberpunk cityscape",
AspectRatio: reve.Ratio16x9,
TestTimeScaling: 2,
Postprocess: []reve.Postprocess{reve.Upscale(2)},
})img, _ := reve.NewImageFromFile("photo.jpg")
result, err := client.Images.Edit(ctx, &reve.EditParams{
Instruction: "Convert to watercolor painting",
ReferenceImage: img.Base64(),
Version: reve.VersionLatestFast, // 5 credits
})style, _ := reve.NewImageFromFile("style.png")
content, _ := reve.NewImageFromFile("content.png")
result, err := client.Images.Remix(ctx, &reve.RemixParams{
Prompt: fmt.Sprintf("Apply %s to %s", reve.Ref(0), reve.Ref(1)),
ReferenceImages: []string{style.Base64(), content.Base64()},
})requests := []*reve.CreateParams{
{Prompt: "A red apple"},
{Prompt: "A green pear"},
}
results := client.Images.BatchCreate(ctx, requests, &reve.BatchConfig{
Concurrency: 3,
})
fmt.Printf("Success: %d/%d\n", reve.SuccessCount(results), len(results))result, err := client.Images.Create(ctx, params)
if err != nil {
var apiErr *transport.APIError
if errors.As(err, &apiErr) {
if apiErr.IsRateLimit() {
// Wait and retry
}
if apiErr.IsInsufficientFunds() {
// Need more credits
}
}
}cost := reve.EstimateCreate(1, nil)
fmt.Println(cost) // "18 credits (~$0.0240)"
cost = reve.EstimateEdit(true, 1, nil) // Fast mode
fmt.Println(cost) // "5 credits (~$0.0067)"Run examples with:
REVE_API_KEY=your-key go run examples/basic/main.go
REVE_API_KEY=your-key go run examples/create/main.go
REVE_API_KEY=your-key go run examples/edit/main.go
REVE_API_KEY=your-key go run examples/remix/main.go
REVE_API_KEY=your-key go run examples/batch/main.go
REVE_API_KEY=your-key go run examples/proxy/main.go
REVE_API_KEY=your-key go run examples/error-handling/main.go
REVE_API_KEY=your-key go run examples/complete/main.go| Endpoint | Credits | ~USD |
|---|---|---|
| Create | 18 | $0.024 |
| Edit | 30 | $0.040 |
| Edit Fast | 5 | $0.007 |
| Remix | 30 | $0.040 |
| Remix Fast | 5 | $0.007 |
- Fork the repo
- Create feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add feature') - Push (
git push origin feature/amazing) - Open Pull Request
MIT License - see LICENSE
This is an unofficial SDK, not affiliated with Reve.