CaptchaSonic 1.0.1
Requires NuGet 5.0 or higher.
dotnet add package CaptchaSonic --version 1.0.1
NuGet\Install-Package CaptchaSonic -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CaptchaSonic" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CaptchaSonic" Version="1.0.1" />
<PackageReference Include="CaptchaSonic" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CaptchaSonic --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CaptchaSonic, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CaptchaSonic@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CaptchaSonic&version=1.0.1
#tool nuget:?package=CaptchaSonic&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CaptchaSonic
Official C# / .NET SDK for the CaptchaSonic CAPTCHA solving API.
Transport
Uses native gRPC via Grpc.Net.Client. Images are sent as raw binary, with no base64 overhead.
Installation
dotnet add package CaptchaSonic
Quick Start
using CaptchaSonic;
await using var client = new CaptchaSonicClient(new CaptchaSonicOptions
{
ApiKey = "sonic_your_api_key"
});
double balance = await client.GetBalanceAsync();
Console.WriteLine($"Balance: ${balance:F4}");
byte[] tile = await File.ReadAllBytesAsync("tile.png");
var result = await client.SolvePopularCaptchaAsync(
images: new[] { tile },
question: "Select all traffic lights",
questionType: "objectClassify"
);
Console.WriteLine(string.Join(", ", result.TypedSolution.Grid.Objects));
Simple constructor
await using var client = new CaptchaSonicClient("sonic_your_api_key");
Configuration
var client = new CaptchaSonicClient(new CaptchaSonicOptions
{
ApiKey = "sonic_your_api_key", // required, must start with "sonic_"
Endpoint = "https://api.captchasonic.com", // optional, default shown
CallTimeout = TimeSpan.FromSeconds(30), // optional, per-call gRPC deadline
});
The client is thread-safe — create one instance and reuse it throughout your application.
Image Solvers
SolvePopularCaptchaAsync()
await client.SolvePopularCaptchaAsync(
images: new[] { tile },
question: "Select all traffic lights",
questionType: "objectClassify", // "objectClassify" | "objectClick" | "objectDrag" | "grid"
examples: null, // optional reference images
screenshot: false, // optional
websiteUrl: "https://example.com", // optional, billing context
websiteKey: null // optional, billing context
);
SolveRecaptchaV2Async()
await client.SolveRecaptchaV2Async(
images: new[] { tile },
question: "traffic lights", // or "/m/015qff"
questionType: "split_33", // "split_33" | "33" | "44". Optional.
websiteUrl: null, // optional
websiteKey: null // optional
);
SolveGeetestAsync()
await client.SolveGeetestAsync(
geetestType: "nine", // "nine" | "click" | "slide" | "match" | "winlinze"
question: "the bear", // required for "nine" and "click"
images: new[] { tile }, // required for "nine", "click", "slide"
examples: null, // optional reference images
image: null, // slice piece for "slide"
gtv: 3, // Geetest version, default 3
websiteUrl: null // optional
);
SolveOcrAsync()
await client.SolveOcrAsync(
images: new[] { tile },
module: "common", // "common" | "mtcaptcha" | "bls" | "morocco"
websiteUrl: null // optional
);
// Returns: result.TypedSolution.Text.Texts[0]
SolveTikTokAsync()
await client.SolveTikTokAsync(
type: "whirl", // "click" | "whirl" | "slide"
question: "", // optional
images: new[] { tile },
examples: null, // required for "whirl" and "slide"
websiteUrl: null // optional
);
SolveBinanceAsync()
await client.SolveBinanceAsync(
type: "grid", // "grid" | "slide"
question: "Select the bicycle", // required for "grid"
images: new[] { tile },
examples: null, // optional
websiteUrl: null // optional
);
SolveAwsWafAsync()
await client.SolveAwsWafAsync(
images: new[] { tile },
question: "grid:vehicles:cars",
websiteUrl: null, // optional
websiteKey: null // optional
);
SolveSlideImageAsync()
await client.SolveSlideImageAsync(images: new[] { background, piece });
// Returns: result.TypedSolution.Slide.X — pixel offset
Token Automation Methods
These submit a task and poll until a token is returned (up to 120s).
await client.SolveTurnstileAsync(websiteUrl, websiteKey, proxy?);
await client.SolvePopularCaptchaTokenAsync(websiteUrl, websiteKey, proxy?);
await client.SolveRecaptchaV2TokenAsync(websiteUrl, websiteKey, proxy?);
await client.SolveRecaptchaV3TokenAsync(websiteUrl, websiteKey, proxy?);
await client.SolveCloudflareAsync(websiteUrl, websiteKey, proxy); // proxy required
Utility Methods
double balance = await client.GetBalanceAsync();
var health = await client.HealthCheckAsync();
var result = await client.GetTaskResultAsync(taskId);
var response = await client.CreateTaskAsync(task);
Error Handling
try
{
var result = await client.SolvePopularCaptchaAsync(images, question, questionType);
}
catch (InvalidApiKeyException) { /* errorId=1 */ }
catch (InsufficientBalanceException) { /* errorId=2 */ }
catch (DailyLimitExceededException) { /* errorId=3 */ }
catch (MinuteLimitExceededException) { /* errorId=4 */ }
catch (QuotaExceededException) { /* errorId=5 */ }
catch (PlanExpiredException) { /* errorId=6 */ }
catch (CaptchaSonicException) { /* other errors */ }
Retries automatically on Unavailable, ResourceExhausted, DeadlineExceeded with exponential backoff.
Publishing to NuGet
# 1. Pack
dotnet pack -c Release
# 2. Push
dotnet nuget push bin/Release/CaptchaSonic.1.0.0.nupkg \
--api-key YOUR_NUGET_API_KEY \
--source https://api.nuget.org/v3/index.json
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Google.Protobuf (>= 3.27.2)
- Grpc.Net.Client (>= 2.65.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.