mirror of
https://github.com/hanzoai/site.git
synced 2026-11-21 01:07:08 +00:00
1 line
2.8 KiB
JSON
1 line
2.8 KiB
JSON
{"text":["Integrations","Go","🐹","Languages","Use Hanzo AI with Go","Use Hanzo AI in Go using the official OpenAI Go client or any OpenAI-compatible Go library. Hanzo's standard REST API works with all HTTP clients.","Base URL:","https://api.hanzo.ai/v1","Get yours at","Fully OpenAI-compatible","400+ models","available","API Key:","platform.hanzo.ai/api-keys","Created by","Go Authors / Google","License:","BSD-3-Clause","View source on GitHub →","Hanzo AI is OpenAI-compatible, so existing Go code works with zero refactoring. We deeply appreciate the Go Authors / Google team for building and maintaining this open-source project.","OpenAI Go client","go","get github","com/openai/openai-","package","main","import","context","fmt","github.com/openai/openai-go","github.com/openai/openai-go/option","func","()","client := openai","NewClient","option","WithBaseURL","),","WithAPIKey","your-hanzo-api-key","resp","_ := client","Chat","Completions","New","Background","(),","openai","ChatCompletionNewParams","Model","zen4-pro","Messages","([]","ChatCompletionMessageParamUnion","UserMessage","Hello from Go!","}),","},","Println","Choices","].","Message","Content","Raw HTTP client","bytes","encoding/json","io","net/http","os","body","_ := json","Marshal","map","string","any","model","messages","[]","{{","role","user","content","Hello!","}},","})","req","_ := http","NewRequest","POST","https://api.hanzo.ai/v1/chat/completions","NewReader","))","Header","Set","Authorization","Bearer","+os","Getenv","HANZO_API_KEY","Content-Type","application/json","DefaultClient","Do","defer","Body","Close","Copy","Stdout","Streaming","stream","NewStreaming","Write a poem","for","Next","chunk := stream","Current","if","len","chunk","Print","Delta","Environment","bash","export","HANZO_API_KEY=","run","main.go","Ready to get started?","Create a free account and get your API key. The Free plan includes free model requests and Kai decisions, no card.","Get API key — Free","Browse Models","More integrations","OpenAI Python SDK","Anthropic SDK","LangChain","LlamaIndex","Vercel AI SDK","Hugging Face","AutoGen","CrewAI","DSPy","Haystack","Cursor","Continue.dev","GitHub Copilot","Docker","Kubernetes","Python","TypeScript","Rust"],"links":["/integrations","https://platform.hanzo.ai/api-keys","https://go.dev","https://github.com/golang/go","/models","/integrations/openai-sdk","/integrations/anthropic-sdk","/integrations/langchain","/integrations/llamaindex","/integrations/vercel-ai-sdk","/integrations/huggingface","/integrations/autogen","/integrations/crewai","/integrations/dspy","/integrations/haystack","/integrations/cursor","/integrations/continue-dev","/integrations/github-copilot","/integrations/docker","/integrations/kubernetes","/integrations/python","/integrations/typescript","/integrations/rust"]} |