Skip to content

TheGP/vrchat-go-with-proxy

 
 

Repository files navigation

VRChat API Library for Go with proxy & rate limiting

A Go client to interact with VRChat API. Supports all REST calls specified in the API specification.

The *.gen.go files are generated by using mayocream/openapi-codegen.

TODO

If request fails because of proxy: |dp | 2025-06-30T10:16:59Z ERR services/vruser/user.go:714 > Failed to get user instances groups error="error sending request: Get "https://api.vrchat.cloud/api/1/users/usr_5d5c18e5-b741-45b2-9387-74e75f14d206/instances/groups\": proxyconnect tcp: dial tcp 184.174.46.225:5854: i/o timeout" user_id=usr_5d5c18e5-b741-45b2-9387-74e75f14d206 try again for 10 min and replace proxy if doesnt work

Usage

Basic Usage

package main

import (
	"fmt"
	"github.com/TheGP/vrchat-go-with-proxy"
	"time"
)

func main() {
	client := vrchat.NewClient("https://api.vrchat.cloud/api/1", time.Minute*1)

	// Authenticate with custom User-Agent
	userAgent := "my-custom-app/1.0 user@email.com"
	err := client.Authenticate("username", "password", "totp-code", userAgent)
	if err != nil {
		panic(err)
	}

	fmt.Println("Authenticated!")
}

Getting auth cookies

After authenticating, you can get the cookies using the GetCookies method:

// After authenticating:
cookies := client.GetCookies() // []*http.Cookie

To save them for later. If cookie authentication failed, you can clear them using the ClearCookies method:

client.ClearCookies()

You have to do it before authenticating normally.

Authenticate Using Cookies

If you have previously saved authentication cookies, you can authenticate using them:

package main

import (
	"github.com/TheGP/vrchat-go-with-proxy"
	"net/http"
	"time"
)

func main() {
	client := vrchat.NewClient("https://api.vrchat.cloud/api/1", time.Minute*1)

	// Load your cookies (from DB, file, etc)
	var cookies []*http.Cookie
	// ... load cookies ...

	userAgent := "my-custom-app/1.0 user@email.com"
	err := client.AuthenticateWithCookies(cookies, userAgent)
	if err != nil {
		panic(err)
	}

	// Now you can make authenticated requests
}

Using Proxy Support

This fork adds HTTP proxy support to the original VRChat Go client:

package main

import (
	"github.com/TheGP/vrchat-go-with-proxy"
	"time"
)

func main() {
	// Create proxy configuration
	proxyConfig := &vrchat.ProxyConfig{
		Host:     "proxy-host",     // Proxy server hostname or IP
		Port:     "8080",          // Proxy server port
		Username: "proxy-username", // Optional: proxy authentication username
		Password: "proxy-password", // Optional: proxy authentication password
	}

	client := vrchat.NewClientWithProxy("https://api.vrchat.cloud/api/1", proxyConfig, time.Minute*1)

	// Testing proxy
	ip, err := client.TestProxy()
	if err != nil {
		log.Fatalf("Proxy test failed: %v", err)
	}
	fmt.Println("Proxy IP:", ip)

	userAgent := "my-custom-app/1.0 user@email.com"
	err := client.Authenticate("username", "password", "totp-code", userAgent)
	if err != nil {
		panic(err)
	}

	// ...
}

About

VRChat Go OpenAPI client with proxy support & rate limiting

Resources

License

Stars

2 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages

  • Go 99.9%
  • Shell 0.1%