Error Handling - MyTokenGate
- Try obtaining the HTTP error code to initially locate the issue
a. In your code, try to print the error code and error message (message). Using this information, most issues can be located.
HTTP/1.1 400 Bad Request
Date: Thu, 19 Dec 2024 08:39:19 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 87
Connection: keep-alive
{"code":20012,"message":"Model does not exist. Please check it carefully.","data":null}- Common error codes and their causes:
400: Incorrect parameters. Refer to the error message to correct invalid request parameters.401: API Key is not properly set.403: Insufficient permissions. The model may require real-name authentication.429: Rate limits triggered. Check RPM/RPD/TPM/TPD/IPM/IPD limits.504/503: High system load. Try again later or use streaming output ("stream": true).500: Unknown server error. Contact help@MyTokenGate.com for troubleshooting.
b. If the client does not output corresponding information, you can try running the curl command in the command line (taking an LLM model as an example):
curl --request POST \
--url https://gateway.mytokengate.com/v1/chat/completions \
--header 'accept: application/json' \
--header 'authorization: Bearer Replace_with_your_apikey' \
--header 'content-type: application/json' \
--data '{
"model": "Remember_to_replace_with_model",
"messages": [
{
"role": "user",
"content": "Hello"
}
],
"max_tokens": 128
}' -i- Try switching to another model to see if the issue persists
Last updated on