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)
} Detección profesional de género para tus aplicaciones
Gender-API.com ofrece detección de gender de nivel empresarial con un 99,5% de precisión en más de 150 países. Nuestra API especializada supera a las soluciones genéricas de IA con tiempos de respuesta entre 10 y 90 veces más rápidos y una precisión entre un 9 y un 34% mejor.
¿Por qué elegir Gender-API en lugar de una IA genérica?
- Diseñado específicamente para esto : Especializado en la detección de gender, no es una IA de propósito general
- Rápido como un rayo : Tiempos de respuesta de menos de 100 ms frente a segundos con una IA genérica
- Más preciso : 99,5% de precisión con inteligencia cultural y regional
- Base de datos más grande : más de 9 millones de nombres, un 37% más que los datos típicos de entrenamiento de IA
- Confiable SLA de disponibilidad del 99,9% con rendimiento predecible
Funciones clave
- Integración sencilla con solo unas pocas líneas de código
- Procesamiento por lotes para aplicaciones de gran volumen
- Precisión específica por país para variaciones regionales de nombres
- Normalización inteligente para gestionar errores tipográficos y variantes
- Cumple con el RGPD y está listo para empresas
Empieza gratis hoy
Consigue 100 llamadas gratuitas a la API al mes, sin necesidad de tarjeta de crédito. Escala a medida que creces con precios flexibles para cada caso de uso.