go get github.com/VedAstro/VedAstro.Go@v1.0.0

Free Advanced Go Vedic Astrology Library & API

The VedAstro Go library gives you instant access to the world's most comprehensive Vedic astrology engine — planet positions, divisional charts, dasa periods, compatibility reports, and AI-powered features, all through a lightweight SDK.

VedAstro Go Library - Vedic Astrology meets Go

Whether you're building a horoscope app, a matchmaking platform, or a research tool, VedAstro's Go library removes every barrier between you and professional-grade Vedic astrology calculations. No complicated setup. No local binaries. No astrology expertise required to get started. Just install the library, set your API key, and start computing — the heavy lifting runs on VedAstro's cloud engine.

What You're Getting

684

Hosted calculations for Vedic astrology applications

47

Ayanamsa systems — Lahiri, Raman, KP, Fagan-Bradley & 43 more

D1–D60

Divisional charts — full Parashari varga system coverage

AI-Powered

Horoscope predictions and classical-text search

Zero Deps

Everything runs in the cloud — your app stays lightweight

Open Source

MIT licensed, community maintained, fully auditable on GitHub

Simple by Design

The VedAstro Go library is a thin, elegant wrapper around the VedAstro REST API. You write Go; the cloud does the calculation.

Go Code → vedastro library → VedAstro Cloud Engine → Result
No heavy installation

The library itself is tiny — everything runs server-side

Always up to date

Calculation improvements roll out on the server automatically

Scales with you

From personal projects to production apps, same code works

Install the Go SDK

Go 1.26 or newer and an internet connection

VedAstro Go SDK installation
go mod init example.com/my-vedastro-app
go get github.com/VedAstro/VedAstro.Go@v1.0.0

Package reference

Every calculator takes a context and returns (any, error). Check errors before reading the dynamic payload. Save the quick start as main.go and run go run .; other demos use internal/exampleutil and must run inside the cloned SDK repository.

FreeAPIUser allows 5 requests per minute. Pace multi-call examples or use your subscription key. Locations take longitude before latitude.

Ready to Unlock 684 Calculations?

Get unlimited access for just $1/month — no rate limits, all features included

Buy Now - $1/month

Instant activation • Cancel anytime • 99.9% uptime guarantee

See It in Action

Start with one Sun-sign calculation using the free key.

package main

import (
	"context"
	"fmt"
	"log"

	vedastro "github.com/VedAstro/VedAstro.Go"
)

func main() {
	client := vedastro.NewClient("FreeAPIUser")
	birth, err := vedastro.NewTime("14:30 25/10/1992 +05:30",
		vedastro.NewGeoLocation("Mumbai", 72.8777, 19.0760))
	if err != nil {
		log.Fatal(err)
	}
	result, err := client.PlanetRasiD1Sign(context.Background(), vedastro.PlanetSun, birth)
	if err != nil {
		log.Fatal(err)
	}
	sign, ok := result.(map[string]any)
	if !ok {
		log.Fatal("unexpected Sun sign response")
	}
	fmt.Println("Sun sign:", sign["Name"])
}

Save as main.go in the module created above and run go run .

marriage compatibility

Run from the cloned SDK repository; helper files are included there.

package main

import (
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Compatibility report", func() (any, error) { return r.Client.MatchReport(r.Context, r.Birth, r.Other) }); err != nil {
			return err
		}
		return nil
	})
}
View example source

vimshottari dasa

Run from the cloned SDK repository; helper files are included there.

package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		return r.Show("Vimshottari dasa", func() (any, error) {
			return r.Client.DasaForLife(r.Context, r.Birth, vedastro.DasaForLifeOptions{
				System: vedastro.Ptr(vedastro.DasaSystemVimshottariJanma),
				Depth:  vedastro.Ptr(3),
			})
		})
	})
}
View example source

Stop Using the Free Tier — Go Pro for $1/month

Remove rate limits and get instant access to all 684 calculations

Buy API Key Now

684 Calculations Across Every Major Category

Category What's Included
Planets Positions, longitudes, strengths, aspects, conjunctions, retrograde status
Houses / Bhavas House signs, lords, bhava chart, all house data
Divisional Charts D1 through D60 — Navamsha, Drekkana, and all varga charts
Zodiac / Rasi Sign-based calculations, planet-in-sign queries
Dasas Vimshottari dasa periods with explicit starting rules and configurable depth
Events & Muhurtha Auspicious time finding, event predictions over any date range
Match / Compatibility Kuta scoring, full compatibility reports, BaZi integration, AI chat analysis
AI Features Birth time auto-fill from partial data, natural language horoscope search

Full method reference: vedastro.org/API.html

47 Ayanamsa Systems — Vedic, Western, and KP

Switch ayanamsa systems with SDK-specific settings

Lahiri

Modern Vedic standard

Raman

Classical Vedic system

Krishnamurti

KP System

Fagan-Bradley

Western sidereal

package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		for _, name := range []vedastro.Ayanamsa{vedastro.AyanamsaLahiri, vedastro.AyanamsaRaman, vedastro.AyanamsaKrishnamurti} {
			ctx := vedastro.WithAyanamsa(r.Context, name)
			if err := r.Show(string(name), func() (any, error) { return r.Client.AyanamsaDegree(ctx, r.Birth) }); err != nil {
				return err
			}
		}
		return nil
	})
}

Run this example inside the cloned repository. View source.

Start Free. Scale When You're Ready.

Free

Rate-limited

'FreeAPIUser'

No signup required — ideal for exploration and development

Subscriber

Unlimited access

Buy Now - $1/month

High-speed access to all 684 calculations for production apps

client := vedastro.NewClient("your-key-here")

Ready-to-Run Examples

Clone the repository to run these examples with their included helpers. Expand an example to read and copy its source.

View source on GitHub
package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Planet data", func() (any, error) { return r.Client.AllPlanetData(r.Context, vedastro.PlanetSun, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("House data", func() (any, error) { return r.Client.AllHouseData(r.Context, vedastro.House1, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("Zodiac data", func() (any, error) { return r.Client.AllZodiacSignData(r.Context, vedastro.ZodiacGemini, r.Birth) }); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	"encoding/csv"
	"encoding/json"
	"fmt"
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
	"os"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		rows := [][]string{{"planet", "result_json"}}
		for _, planet := range []vedastro.PlanetName{vedastro.PlanetSun, vedastro.PlanetMoon, vedastro.PlanetMars,
			vedastro.PlanetMercury, vedastro.PlanetJupiter, vedastro.PlanetVenus, vedastro.PlanetSaturn, vedastro.PlanetRahu, vedastro.PlanetKetu} {
			value, err := r.Fetch(func() (any, error) { return r.Client.AllPlanetData(r.Context, planet, r.Birth) })
			if err != nil {
				return err
			}
			encoded, err := json.Marshal(value)
			if err != nil {
				return err
			}
			rows = append(rows, []string{string(planet), string(encoded)})
		}
		file, err := os.OpenFile("planet_data.csv", os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600)
		if err != nil {
			return err
		}
		defer file.Close()
		writer := csv.NewWriter(file)
		if err := writer.WriteAll(rows); err != nil {
			return err
		}
		fmt.Println("Saved planet_data.csv")
		return nil
	})
}

View source on GitHub
package main

import (
	"encoding/json"
	"fmt"
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
	"os"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		data := map[string]any{}
		calls := []struct {
			name string
			call func() (any, error)
		}{
			{"planet", func() (any, error) { return r.Client.AllPlanetData(r.Context, vedastro.PlanetSun, r.Birth) }},
			{"house", func() (any, error) { return r.Client.AllHouseData(r.Context, vedastro.House1, r.Birth) }},
			{"zodiac", func() (any, error) { return r.Client.AllZodiacSignData(r.Context, vedastro.ZodiacGemini, r.Birth) }},
		}
		for _, item := range calls {
			value, err := r.Fetch(item.call)
			if err != nil {
				return err
			}
			data[item.name] = value
		}
		file, err := os.OpenFile("astro_data.json", os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600)
		if err != nil {
			return err
		}
		defer file.Close()
		encoder := json.NewEncoder(file)
		encoder.SetIndent("", "  ")
		if err := encoder.Encode(data); err != nil {
			return err
		}
		fmt.Println("Saved astro_data.json")
		return nil
	})
}

View source on GitHub
package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("All Sun data", func() (any, error) { return r.Client.AllPlanetData(r.Context, vedastro.PlanetSun, r.Birth) }); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	"fmt"
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		// Add customer records here. Every call is paced for the free API key.
		for index, birth := range []vedastro.Time{r.Birth, r.Other} {
			if err := r.Show(fmt.Sprintf("Chart %d", index+1), func() (any, error) {
				return r.Client.PlanetRasiD1Sign(r.Context, vedastro.PlanetSun, birth)
			}); err != nil {
				return err
			}
		}
		return nil
	})
}

View source on GitHub
package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Ascendant sign", func() (any, error) { return r.Client.HouseSignName(r.Context, vedastro.House1, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("Planets in house 1", func() (any, error) { return r.Client.PlanetsInHouseBasedOnSign(r.Context, vedastro.House1, r.Birth) }); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Sun sign", func() (any, error) { return r.Client.PlanetRasiD1Sign(r.Context, vedastro.PlanetSun, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("Moon sign", func() (any, error) { return r.Client.PlanetRasiD1Sign(r.Context, vedastro.PlanetMoon, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("Ascendant", func() (any, error) { return r.Client.HouseSignName(r.Context, vedastro.House1, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("Birth constellation", func() (any, error) { return r.Client.MoonConstellation(r.Context, r.Birth) }); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("House occupied by the Sun", func() (any, error) {
			return r.Client.HousePlanetOccupiesBasedOnSign(r.Context, vedastro.PlanetSun, r.Birth)
		}); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Current Sun sign", func() (any, error) { return r.Client.PlanetRasiD1Sign(r.Context, vedastro.PlanetSun, r.Now) }); err != nil {
			return err
		}
		if err := r.Show("Current Saturn sign", func() (any, error) { return r.Client.PlanetRasiD1Sign(r.Context, vedastro.PlanetSaturn, r.Now) }); err != nil {
			return err
		}
		if err := r.Show("Saturn retrograde", func() (any, error) { return r.Client.IsPlanetRetrograde(r.Context, vedastro.PlanetSaturn, r.Now) }); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		for _, name := range []vedastro.Ayanamsa{vedastro.AyanamsaLahiri, vedastro.AyanamsaRaman, vedastro.AyanamsaKrishnamurti} {
			ctx := vedastro.WithAyanamsa(r.Context, name)
			if err := r.Show(string(name), func() (any, error) { return r.Client.AyanamsaDegree(ctx, r.Birth) }); err != nil {
				return err
			}
		}
		return nil
	})
}

View source on GitHub
package main

import (
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Tithi", func() (any, error) { return r.Client.LunarDay(r.Context, r.Now) }); err != nil {
			return err
		}
		if err := r.Show("Nakshatra", func() (any, error) { return r.Client.MoonConstellation(r.Context, r.Now) }); err != nil {
			return err
		}
		if err := r.Show("Yoga", func() (any, error) { return r.Client.NithyaYoga(r.Context, r.Now) }); err != nil {
			return err
		}
		if err := r.Show("Karana", func() (any, error) { return r.Client.Karana(r.Context, r.Now) }); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("D1", func() (any, error) { return r.Client.AllHouseRasiSigns(r.Context, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("D9", func() (any, error) { return r.Client.AllHouseNavamshaSign(r.Context, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("D10", func() (any, error) { return r.Client.AllHouseDashamamshaSign(r.Context, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("Sun D9", func() (any, error) { return r.Client.PlanetNavamshaD9Sign(r.Context, vedastro.PlanetSun, r.Birth) }); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	"context"
	"errors"
	"fmt"
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		// Cancellation is checked before the HTTP request; this intentionally makes no API call.
		ctx, cancel := context.WithCancel(r.Context)
		cancel()
		_, err := r.Client.PlanetRasiD1Sign(ctx, vedastro.PlanetSun, r.Birth)
		if errors.Is(err, context.Canceled) {
			fmt.Println("Canceled request handled")
		} else {
			return fmt.Errorf("expected cancellation, got %v", err)
		}
		err = r.Show("Sun sign", func() (any, error) { return r.Client.PlanetRasiD1Sign(r.Context, vedastro.PlanetSun, r.Birth) })
		var apiErr *vedastro.APIError
		if errors.As(err, &apiErr) {
			fmt.Printf("API endpoint %s returned HTTP %d\n", apiErr.Endpoint, apiErr.StatusCode)
		}
		return err
	})
}

View source on GitHub
package main

import (
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Horoscope predictions", func() (any, error) { return r.Client.HoroscopePredictions(r.Context, r.Birth) }); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Compatibility report", func() (any, error) { return r.Client.MatchReport(r.Context, r.Birth, r.Other) }); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Match report", func() (any, error) { return r.Client.MatchReport(r.Context, r.Birth, r.Other) }); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Birth number", func() (any, error) { return r.Client.BirthNumber(r.Context, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("Destiny number", func() (any, error) { return r.Client.DestinyNumber(r.Context, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("Name prediction", func() (any, error) { return r.Client.NameNumberPrediction(r.Context, "Sengiv") }); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	"context"
	"fmt"
	"log"

	vedastro "github.com/VedAstro/VedAstro.Go"
)

func main() {
	client := vedastro.NewClient("FreeAPIUser")
	birth, err := vedastro.NewTime("14:30 25/10/1992 +05:30",
		vedastro.NewGeoLocation("Mumbai", 72.8777, 19.0760))
	if err != nil {
		log.Fatal(err)
	}
	result, err := client.PlanetRasiD1Sign(context.Background(), vedastro.PlanetSun, birth)
	if err != nil {
		log.Fatal(err)
	}
	sign, ok := result.(map[string]any)
	if !ok {
		log.Fatal("unexpected Sun sign response")
	}
	fmt.Println("Sun sign:", sign["Name"])
}

View source on GitHub
package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Available books", func() (any, error) { return r.Client.GetAvailableSourceTexts(r.Context) }); err != nil {
			return err
		}
		if err := r.Show("Saturn in the seventh house", func() (any, error) {
			return r.Client.SearchSourceText(r.Context, "effects of Saturn in the 7th house", vedastro.SearchSourceTextOptions{TopK: vedastro.Ptr(3)})
		}); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		if err := r.Show("Natal Saturn sign", func() (any, error) { return r.Client.PlanetRasiD1Sign(r.Context, vedastro.PlanetSaturn, r.Birth) }); err != nil {
			return err
		}
		if err := r.Show("Current Saturn sign", func() (any, error) { return r.Client.PlanetRasiD1Sign(r.Context, vedastro.PlanetSaturn, r.Now) }); err != nil {
			return err
		}
		if err := r.Show("Current Saturn house", func() (any, error) {
			return r.Client.HousePlanetOccupiesBasedOnLongitudes(r.Context, vedastro.PlanetSaturn, r.Now)
		}); err != nil {
			return err
		}
		return nil
	})
}

View source on GitHub
package main

import (
	vedastro "github.com/VedAstro/VedAstro.Go"
	"github.com/VedAstro/VedAstro.Go/internal/exampleutil"
)

func main() {
	exampleutil.Run(func(r *exampleutil.Runner) error {
		return r.Show("Vimshottari dasa", func() (any, error) {
			return r.Client.DasaForLife(r.Context, r.Birth, vedastro.DasaForLifeOptions{
				System: vedastro.Ptr(vedastro.DasaSystemVimshottariJanma),
				Depth:  vedastro.Ptr(3),
			})
		})
	})
}

Browse All Examples on GitHub

Open Source MIT License

Open Source at Its Core

The VedAstro Go library is fully open source under the MIT License. You can read the code, verify every API call, and contribute improvements back to the community. The library is maintained alongside the main VedAstro engine — when new calculations are added to the API, the Go wrapper updates to match.

Note: Calculator wrappers are generated to follow the hosted API. See the repository for source, generator guidance, and contribution instructions.

Ready to Build?

Install the library, try the free tier, and see how fast you can go from zero to a working Vedic astrology application. When your project is ready for the real world, your API key is one click away.

go get github.com/VedAstro/VedAstro.Go@v1.0.0

Made and funded by users — Support VedAstro