Steps to reproduce:
Use this script
#!/usr/bin/env sh
query=$@
response=$(curl --silent \
-H "Authorization: Bot $KAGI_API_TOKEN" \
-H "Content-Type: application/json" \
--data "{\"query\": \"$query\"}" \
https://kagi.com/api/v0/fastgpt)
echo $response | jq
answer=$(echo $response | jq '.data.output')
echo -e $answer
now execute the script with a query like fastgpt who invented unix
Expected behavior:
This same script used to work a few minutes ago, but now it fails. I did quite a lot of requests before. Am I being rate limited?
Unfortunately I get this:
{
"meta": {
"id": "0ab037b3-fe17-43ed-9a54-f0f390015abc",
"node": "europe-west4",
"ms": 106
},
"data": {
"output": null,
"tokens": 0
},
"error": [
{
"code": 200,
"msg": "Failed to process request",
"ref": null
}
]
}
Debug info:
verbose curl output:
./executable_fastgpt who invented unix
* Trying 34.111.242.115:443...
* Connected to kagi.com (34.111.242.115) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
* CApath: none
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS header, Certificate Status (22):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.2 (IN), TLS header, Finished (20):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [15 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [4029 bytes data]
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
{ [264 bytes data]
* TLSv1.3 (IN), TLS handshake, Finished (20):
{ [52 bytes data]
* TLSv1.2 (OUT), TLS header, Finished (20):
} [5 bytes data]
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Finished (20):
} [52 bytes data]
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted h2
* Server certificate:
* subject: CN=*.kagi.com
* start date: Apr 17 13:34:22 2023 GMT
* expire date: Jul 16 13:34:21 2023 GMT
* subjectAltName: host "kagi.com" matched cert's "kagi.com"
* issuer: C=US; O=Let's Encrypt; CN=R3
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* h2h3 [:method: POST]
* h2h3 [:path: /api/v0/fastgpt]
* h2h3 [:scheme: https]
* h2h3 [:authority: kagi.com]
* h2h3 [user-agent: curl/7.85.0]
* h2h3 [accept: */*]
* h2h3 [content-type: application/json]
* h2h3 [content-length: 30]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
> POST /api/v0/fastgpt HTTP/2
> Host: kagi.com
> user-agent: curl/7.85.0
> accept: */*
> content-type: application/json
> content-length: 30
>
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* We are completely uploaded and fine
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [267 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [267 bytes data]
* old SSL session ID is stale, removing
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
< HTTP/2 200
< x-request-id: 9f87e5f7-c824-4a7d-bbdf-e19b7faed389
< cache-control: no-store
< content-type: application/json
< content-length: 187
< date: Tue, 06 Jun 2023 07:34:20 GMT
< via: 1.1 google
<
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* Connection #0 to host kagi.com left intact
{
"meta": {
"id": "9f87e5f7-c824-4a7d-bbdf-e19b7faed389",
"node": "europe-west4",
"ms": 105
},
"data": {
"output": null,
"tokens": 0
},
"error": [
{
"code": 200,
"msg": "Failed to process request",
"ref": null
}
]
}