名片识别接口
curl --request POST \
--url https://geekai.co/api/v1/bizcard/recognize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "<string>",
"model": "glm-4v-flash"
}
'import requests
url = "https://geekai.co/api/v1/bizcard/recognize"
payload = {
"image": "<string>",
"model": "glm-4v-flash"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({image: '<string>', model: 'glm-4v-flash'})
};
fetch('https://geekai.co/api/v1/bizcard/recognize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://geekai.co/api/v1/bizcard/recognize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image' => '<string>',
'model' => 'glm-4v-flash'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://geekai.co/api/v1/bizcard/recognize"
payload := strings.NewReader("{\n \"image\": \"<string>\",\n \"model\": \"glm-4v-flash\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://geekai.co/api/v1/bizcard/recognize")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"<string>\",\n \"model\": \"glm-4v-flash\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/v1/bizcard/recognize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image\": \"<string>\",\n \"model\": \"glm-4v-flash\"\n}"
response = http.request(request)
puts response.read_body{
"name": "张三",
"company": "极客智识网络科技有限公司",
"position": "客户经理",
"address": "浙江省杭州市上城区钱江新城",
"phone": [
"+8618888888888",
"057128888888"
],
"email": [
"zhangsan@geekai.dev"
]
}{
"code": "invalid_image",
"message": "图片格式不支持或无法访问"
}{
"code": "unauthorized",
"message": "Invalid API key or token"
}{
"code": "image_too_large",
"message": "图片大小超过5MB限制"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}OCR
Business Card Recognition
POST
/
bizcard
/
recognize
名片识别接口
curl --request POST \
--url https://geekai.co/api/v1/bizcard/recognize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "<string>",
"model": "glm-4v-flash"
}
'import requests
url = "https://geekai.co/api/v1/bizcard/recognize"
payload = {
"image": "<string>",
"model": "glm-4v-flash"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({image: '<string>', model: 'glm-4v-flash'})
};
fetch('https://geekai.co/api/v1/bizcard/recognize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://geekai.co/api/v1/bizcard/recognize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image' => '<string>',
'model' => 'glm-4v-flash'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://geekai.co/api/v1/bizcard/recognize"
payload := strings.NewReader("{\n \"image\": \"<string>\",\n \"model\": \"glm-4v-flash\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://geekai.co/api/v1/bizcard/recognize")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"<string>\",\n \"model\": \"glm-4v-flash\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/v1/bizcard/recognize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image\": \"<string>\",\n \"model\": \"glm-4v-flash\"\n}"
response = http.request(request)
puts response.read_body{
"name": "张三",
"company": "极客智识网络科技有限公司",
"position": "客户经理",
"address": "浙江省杭州市上城区钱江新城",
"phone": [
"+8618888888888",
"057128888888"
],
"email": [
"zhangsan@geekai.dev"
]
}{
"code": "invalid_image",
"message": "图片格式不支持或无法访问"
}{
"code": "unauthorized",
"message": "Invalid API key or token"
}{
"code": "image_too_large",
"message": "图片大小超过5MB限制"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}GeekAI has reconstructed the traditional OCR image recognition service based on AI model services and opened it up in the form of an API interface.
Note: If the
model value is not passed, the free glm-4v-flash is used by default. You can also choose other image recognition models supported by GeekAI in the Model Marketplace. The cost is based on the model price (API) displayed in the list.cURL Request Example
curl --location 'https://geekai.dev/api/v1/bizcard/recognize' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
--data '{
"image": "https://example.com/bizcard.jpg"
}'
Authorizations
bearerAuthapiKeyAuth
API认证token
Body
application/json
Was this page helpful?
⌘I
