CAPTCHA / TEXT
Text
Character recognition on an image. The model for a specific site is chosen by the model field; the response holds the string for the captcha field.
Input
Save the original captcha image as captcha.png. Image requirements differ between models — see the models table.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| image | string | Yes | — | Source image in base64. |
| model | string | Yes | — | Model: gaijin, mojeid, nova. |
Models
| model | Site | Image | Response specifics |
|---|---|---|---|
| gaijin | login.gaijin.net | The original captcha image without the page frame, caption or input field. | extra.char_confidences — the score of each character in text order; extra.length — the string length. |
| mojeid | MojeID | The whole image. Do not cut out characters by hand: the server separates them itself. | Only text and confidence. Do not change the letter case unless the site requires it. |
| nova | Nova88 | The original color image. Do not convert it to black and white: the color filter is part of the processing. | text is already normalized: if at least four digits are found, the first four are taken. extra.raw_ocr is the raw OCR before corrections; do not submit it. confidence may be 0. |
Response
| Recognition data | Type | Description |
|---|---|---|
| model | string | The model from the request. |
| text | string | The recognized string. Enter it into the captcha field as is. |
| confidence | number | Average per-character confidence. |
| extra | object | Fields of the specific model — see the models table. |
Applying the answer
Enter result["text"] into the captcha field in the same site session in which the image was received.
Common mistakes
- The model is not detected from the image: without model the server answers 400.
- Transparency, color and the original scale affect preprocessing; the original file is preferred.
Request example
import base64
from pathlib import Path
import os
import uuid
import requests
def image64(filename):
return base64.b64encode(Path(filename).read_bytes()).decode("ascii")
payload = {
"image": image64("captcha.png"),
"model": "nova",
}
# One ID per task; keep it for network retries.
request_id = str(uuid.uuid4())
response = requests.post(
"https://capi.z3n.pro/v1/solve/text",
headers={
"Authorization": f"Bearer {os.environ['CAPI_API_KEY']}",
"Content-Type": "application/json",
"Idempotency-Key": request_id,
},
json=payload,
timeout=90,
)
response.raise_for_status()
result = response.json()
print(result["text"])
capi.