Go / Golang Client
High-performance Go client for Gender-API.com built with native Go idioms and standard libraries. Our specialized API provides 99.5% accurate gender detection in under 100ms, perfect for concurrent processing and microservices. The client supports goroutines for parallel batch processing and includes proper context handling. Unlike generic AI solutions that are slow and resource-intensive, our API is 10x-90x faster with superior accuracy. Ideal for high-throughput applications, data pipelines, and cloud-native services. Access over 9 million names across 150+ countries with intelligent fallback. Memory-efficient and production-ready with comprehensive error handling. Start free with 100 API calls monthly.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
// Response defines the structure of the JSON response from Gender-API.com
type Response struct {
ResultFound bool `json:"result_found"`
FirstName string `json:"first_name"`
Gender string `json:"gender"`
Probability float64 `json:"probability"`
}
func main() {
// Determine the gender of a first name using API V2
// ---------------------------------------------------
apiKey := "YOUR_API_KEY" // Get your key at https://gender-api.com/en/account/auth-tokens
firstName := "Theresa"
// Construct the JSON payload
requestBody, _ := json.Marshal(map[string]string{
"first_name": firstName,
})
// Create the request
req, err := http.NewRequest("POST", "https://gender-api.com/v2/gender/by-first-name", bytes.NewBuffer(requestBody))
if err != nil {
fmt.Printf("Error creating request: %s\n", err)
return
}
// Set headers
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+apiKey)
// Perform the request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Printf("Error making request: %s\n", err)
return
}
defer resp.Body.Close()
// Read the response body
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Printf("Error reading response: %s\n", err)
return
}
// Parse the JSON response
var result Response
if err := json.Unmarshal(body, &result); err != nil {
fmt.Printf("Error parsing JSON: %s\n", err)
return
}
// Output the result
fmt.Printf("Name: %s\n", result.FirstName)
fmt.Printf("Gender: %s\n", result.Gender)
fmt.Printf("Probability: %.2f\n", result.Probability)
} Rilevamento professionale del genere per le tue applicazioni
Gender-API.com offre un rilevamento del gender di livello enterprise con un’accuratezza del 99,5% in oltre 150 Paesi. La nostra API specializzata supera le soluzioni AI generiche con tempi di risposta 10-90 volte più rapidi e una precisione migliore del 9-34%.
Perché scegliere Gender-API invece di un’IA generica?
- Progettato appositamente : Specializzato per il rilevamento del gender, non un'AI per uso generale
- Fulmineo : Tempi di risposta sotto i 100 ms vs. secondi con l’IA generica
- Più preciso Accuratezza del 99,5% con intelligenza culturale e regionale
- Database più grande 9+ milioni di nomi, il 37% in più rispetto ai tipici dati di addestramento dell’IA
- Affidabile SLA con uptime del 99,9% e prestazioni prevedibili
Funzionalità principali
- Integrazione facile con poche righe di codice
- Elaborazione in batch per applicazioni ad alto volume
- Precisione specifica per Paese per le varianti regionali dei nomi
- Normalizzazione intelligente per gestire refusi e varianti
- Conforme al GDPR e pronto per l’uso in ambito enterprise
Inizia gratis oggi
Ottieni 100 chiamate API gratuite al mese, senza bisogno di carta di credito. Scala man mano che cresci, con prezzi flessibili per ogni caso d’uso.