{"id":47234120,"url":"https://github.com/solarhell/go-tavily","last_synced_at":"2026-03-13T21:37:25.428Z","repository":{"id":342169788,"uuid":"1173130340","full_name":"solarhell/go-tavily","owner":"solarhell","description":"A thin, type-safe Go client for the Tavily API","archived":false,"fork":false,"pushed_at":"2026-03-12T06:05:54.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-12T12:25:34.035Z","etag":null,"topics":["api-client","go","golang","sdk","search-api","tavily","tavily-api","web-search"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/solarhell.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-05T03:19:26.000Z","updated_at":"2026-03-12T06:05:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/solarhell/go-tavily","commit_stats":null,"previous_names":["solarhell/go-tavily"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/solarhell/go-tavily","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solarhell%2Fgo-tavily","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solarhell%2Fgo-tavily/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solarhell%2Fgo-tavily/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solarhell%2Fgo-tavily/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solarhell","download_url":"https://codeload.github.com/solarhell/go-tavily/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solarhell%2Fgo-tavily/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30434106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","go","golang","sdk","search-api","tavily","tavily-api","web-search"],"created_at":"2026-03-13T21:37:23.235Z","updated_at":"2026-03-13T21:37:25.411Z","avatar_url":"https://github.com/solarhell.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Tavily Client\n\n[![Go Version](https://img.shields.io/badge/Go-1.26+-00ADD8?style=for-the-badge\u0026logo=go)](https://golang.org/dl/)\n[![Go Report Card](https://goreportcard.com/badge/github.com/solarhell/go-tavily?style=for-the-badge)](https://goreportcard.com/report/github.com/solarhell/go-tavily)\n[![GoDoc](https://img.shields.io/badge/pkg.go.dev-reference-007d9c?style=for-the-badge\u0026logo=go)](https://pkg.go.dev/github.com/solarhell/go-tavily)\n[![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/solarhell/go-tavily?utm_source=oss\u0026utm_medium=github\u0026utm_campaign=solarhell%2Fgo-tavily\u0026labelColor=171717\u0026color=FF570A\u0026link=https%3A%2F%2Fcoderabbit.ai\u0026label=CodeRabbit+Reviews)](https://coderabbit.ai)\n\nEnglish | [中文](README_zh.md)\n\nA thin, type-safe Go client for the [Tavily API](https://docs.tavily.com). Built for Go 1.26+.\n\n## Installation\n\n```bash\ngo get github.com/solarhell/go-tavily\n```\n\n## Quick Start\n\n```go\nclient := tavily.New(\"tvly-your-api-key\")\n\nresp, err := client.Search(ctx, \u0026tavily.SearchParams{\n    Query: \"Go programming language\",\n})\n```\n\n## Search\n\n```go\nanswerMode := tavily.IncludeAnswerAdvanced\n\nresp, err := client.Search(ctx, \u0026tavily.SearchParams{\n    Query:         \"AI news\",\n    SearchDepth:   tavily.SearchDepthAdvanced,\n    Topic:         tavily.TopicNews,\n    TimeRange:     tavily.TimeRangeWeek,\n    MaxResults:    10,\n    IncludeAnswer: \u0026answerMode,\n})\n```\n\nZero-value fields are omitted from the request — the API uses its own server-side defaults.\n\n## Country Filter\n\nUse an ISO 3166-1 alpha-2 country code to boost search results from a specific country. The country filter is only available when `topic` is `general` (or unset). Country codes are case-insensitive.\n\n```go\nresp, err := client.Search(ctx, \u0026tavily.SearchParams{\n    Query:   \"latest tech news\",\n    Country: \"US\",\n})\n```\n\n\u003e **Note:** Tavily supports ~160 countries. Unsupported country codes will be rejected at call time.  \n\u003e Supported country code mapping file: [`country.go`](./country.go).  \n\u003e Example codes: `US`/`us`, `CN`/`cn`, `JP`/`jp`.  \n\u003e The SDK handles country codes case-insensitively.  \n\u003e Current SDK mapping is implemented as of **2026-03-05**.\n\n## Extract\n\n```go\nresp, err := client.Extract(ctx, \u0026tavily.ExtractParams{\n    URLs:   []string{\"https://example.com\"},\n    Format: tavily.FormatMarkdown,\n})\n```\n\n## Client Options\n\n```go\nclient := tavily.New(\"tvly-your-api-key\",\n    tavily.WithBaseURL(\"https://custom.api.com\"),\n    tavily.WithHTTPClient(\u0026http.Client{Timeout: 45 * time.Second}),\n)\n```\n\nIf the API key is empty, it reads from the `TAVILY_API_KEY` environment variable.\n\n## Error Handling\n\n```go\nresp, err := client.Search(ctx, \u0026tavily.SearchParams{Query: \"test\"})\nif err != nil {\n    var apiErr *tavily.APIError\n    if errors.As(err, \u0026apiErr) {\n        switch {\n        case apiErr.IsUnauthorized():\n            // invalid API key (401)\n        case apiErr.IsRateLimit():\n            // rate limited (429)\n        case apiErr.IsPlanLimitExceeded():\n            // plan usage limit (432)\n        case apiErr.IsPayGoLimitExceeded():\n            // pay-as-you-go limit (433)\n        case apiErr.IsBadRequest():\n            // invalid parameters (400)\n        }\n    }\n}\n```\n\n## Testing\n\n```bash\ngo test -v -race ./...\n```\n\n## Links\n\n- [Tavily API Documentation](https://docs.tavily.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolarhell%2Fgo-tavily","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolarhell%2Fgo-tavily","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolarhell%2Fgo-tavily/lists"}