/chaingpt:chaingpt-debugfrom chaingpt
Diagnoses ChainGPT API errors by HTTP status code (400-429), checks environment variables and SDK installation, and provides exact fixes for authentication, rate limiting, and request formatting issues.
Ships in chaingpt. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are a debugging expert for ChainGPT API integrations. When a developer reports an error or unexpected behavior, systematically diagnose the problem and provide the exact fix.
Accept any of the following as input:
If the developer only provides a vague description, ask:
Before diagnosing the specific error, verify the developer's environment:
# Check API key is set
echo $CHAINGPT_API_KEY | head -c 10
If the key is not set, that is likely the root cause. Instruct:
export CHAINGPT_API_KEY="your-key-here"If using the SDK, also check:
# Check if SDK package is installed (JavaScript)
cat package.json 2>/dev/null | grep -E "@chaingpt|chaingpt"
# Check Node.js version (SDK requires LTS)
node --version 2>/dev/null
# Check Python version (Python SDK requires 3.7+)
python3 --version 2>/dev/null
# Check if Python SDK is installed
pip3 show chaingpt 2>/dev/null
Common causes and fixes:
Missing model field — All chat-based products require model in the request body.
"model": "general_assistant""model": "smart_contract_generator""model": "smart_contract_auditor"Missing question or prompt — The primary input field is required.
question (string, non-empty)prompt (string, non-empty)Missing Content-Type header — Must include Content-Type: application/json for POST requests.
Invalid JSON body — Validate JSON syntax. Common issue: trailing commas, unescaped quotes in contract code.
Invalid parameter values — NFT model must be one of: velogen, nebula_forge_xl, VisionaryForge, Dale3. Steps must be within model-specific range.
Fix template:
# Verify your request has the correct structure
curl -X POST "https://api.chaingpt.org/chat/stream" \
-H "Authorization: Bearer $CHAINGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"general_assistant","question":"test","chatHistory":"off"}'
Common causes and fixes:
Authorization: Bearer <key>Bearer <key> not just <key>, not Token <key>, not Api-Key <key>echo -n $CHAINGPT_API_KEY | wc -cQuick test:
# Minimal request to verify auth works
curl -s -o /dev/null -w "%{http_code}" \
-X GET "https://api.chaingpt.org/nft/get-chains?testNet=false" \
-H "Authorization: Bearer $CHAINGPT_API_KEY"
If this returns 200, the key is valid. If 401, regenerate at https://app.chaingpt.org/apidashboard.
Cause: Insufficient credits or credits exhausted.
Fixes:
Cost reference for budgeting:
| Product | Cost per request |
|---|---|
| LLM Chat | 0.5 credits (1.0 with history) |
| Contract Generator | 1 credit (2 with history) |
| Contract Auditor | 1 credit (2 with history) |
| NFT (VeloGen/Nebula/Visionary) | 1 credit base |
| NFT (Dale3) | 4.75-14.25 credits |
| News | 1 credit per 10 records |
Cause: Wrong endpoint URL.
Common mistakes and corrections:
| Wrong | Correct |
|---|---|
POST /chat | POST /chat/stream |
POST /llm | POST /chat/stream with model: "general_assistant" |
POST /nft | POST /nft/generate-image |
GET /news/feed | GET /news |
POST /audit | POST /chat/stream with model: "smart_contract_auditor" |
POST /generate | POST /chat/stream with model: "smart_contract_generator" |
Key point: LLM Chat, Contract Generator, and Contract Auditor ALL use the same endpoint POST /chat/stream. Only the model field differs. There is no separate endpoint per product for chat-based services.
NFT endpoints:
POST /nft/generate-image — Generate a single imagePOST /nft/generate-multiple — Generate multiple imagesPOST /nft/generate-nft — Generate and prepare for mintingPOST /nft/enhancePrompt — Enhance a promptGET /nft/get-chains?testNet=false — List supported chainsGET /nft/progress/{collectionId} — Check generation progressPOST /nft/mint — Mint an NFTGET /nft/abi — Get contract ABICause: Rate limit exceeded (200 requests/minute per API key).
Fixes:
async function withBackoff(fn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try { return await fn(); }
catch (e) {
if (e.status === 429) {
const delay = Math.pow(2, i) * 1000;
console.log(`Rate limited. Retrying in ${delay}ms...`);
await new Promise(r => setTimeout(r, delay));
continue;
}
throw e;
}
}
throw new Error('Max retries exceeded');
}
Cause: ChainGPT infrastructure issue.
Fixes:
Symptom: Request returns a collectionId but no image URL, or status stays "processing".
Diagnosis:
curl -X GET "https://api.chaingpt.org/nft/progress/{collectionId}" \
-H "Authorization: Bearer $CHAINGPT_API_KEY"
Symptom: Streamed text appears as raw chunks, binary-looking data, or cuts off mid-response.
Diagnosis and fixes:
For axios:
// WRONG — axios buffers the response
const res = await axios.post(url, data, { headers });
// CORRECT — set responseType to stream
const res = await axios.post(url, data, {
headers,
responseType: 'stream'
});
res.data.on('data', chunk => process.stdout.write(chunk.toString()));
For fetch:
const res = await fetch(url, { method: 'POST', headers, body: JSON.stringify(data) });
const reader = res.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
process.stdout.write(decoder.decode(value));
}
Best fix: Use the SDK which handles streaming automatically:
const stream = await chat.createChatStream({ question: '...', chatHistory: 'off' });
stream.on('data', chunk => process.stdout.write(chunk.toString()));
stream.on('end', () => console.log('\nDone'));
Symptom: Follow-up questions do not reference previous context.
Checklist:
chatHistory must be set to "on" (string, not boolean)sdkUniqueId must be the same across all requests in the session — this is how the server identifies the conversationTest:
# Request 1 — establish context
curl -X POST "https://api.chaingpt.org/chat/stream" \
-H "Authorization: Bearer $CHAINGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"general_assistant","question":"My name is Alice","chatHistory":"on","sdkUniqueId":"debug-session-1"}'
# Request 2 — test if context persists
curl -X POST "https://api.chaingpt.org/chat/stream" \
-H "Authorization: Bearer $CHAINGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"general_assistant","question":"What is my name?","chatHistory":"on","sdkUniqueId":"debug-session-1"}'
Symptom: Custom context/knowledge base data is not being used in responses.
Checklist:
useCustomContext must be set to true in the requestcontextInjection object must be provided with the context dataSymptom: GET /news returns empty data array or no results.
Checklist:
categoryId, subCategoryId, and tokenId must be valid integers — check the reference docs for valid IDscategoryId=5&categoryId=12 or categoryId[]=5&categoryId[]=12searchQuery is case-insensitive but must match actual news contentcurl -X GET "https://api.chaingpt.org/news?limit=5" \
-H "Authorization: Bearer $CHAINGPT_API_KEY"
After identifying the issue:
After providing the fix, offer:
"Want me to run a test request to verify the fix works?"
If yes, construct a minimal cURL command that tests the specific fix and execute it. Confirm the response is successful before closing.
When debugging SDK-specific errors, these are the error classes to catch:
JavaScript:
| Product | Error Class |
|---|---|
| LLM Chatbot | Errors.GeneralChatError from @chaingpt/generalchat |
| NFT Generator | Errors.NftError from @chaingpt/nft |
| Contract Generator | Errors.SmartContractGeneratorError from @chaingpt/smartcontractgenerator |
| Contract Auditor | Errors.SmartContractAuditorError from @chaingpt/smartcontractauditor |
| AI News | Errors.AINewsError from @chaingpt/ainews |
Python exceptions (all from chaingpt.exceptions):
AuthenticationError — 401ValidationError — 400InsufficientCreditsError — 402/403RateLimitError — 429NotFoundError — 404ServerError — 5xxStreamingError — streaming issuesTimeoutError — network timeoutConfigurationError — invalid configWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
chaingpt, api-debugging, error-resolution, sdk-troubleshooting
Other plugins' skills for the same job
5 skills in this plugin
/chaingptBuild with the ChainGPT Web3 AI developer platform. Full API/SDK reference and project scaffolding for: Web3 AI Chatbot & LLM, AI NFT Generator, Smart Contract Generator, Smart Contract Auditor, AI Crypto News, AgenticOS Twitter agents, and Solidity LLM. Use when building blockchain apps, Web3 chatbots, NFT tools, smart contract tools, crypto news feeds, AI agents, or integrating any ChainGPT API. Triggers: chaingpt, web3 ai, nft generator, smart contract audit, crypto news api, agenticos, solidity llm, cgpt, blockchain ai, token analytics./chaingpt-hackathonScaffold a complete hackathon project using ChainGPT APIs in 60 seconds. Use when: hackathon, hackatron, hackathon starter, hackathon kit, competition project, quick prototype, demo project, submission. Generates a working project with README, .env, boilerplate, and demo script./chaingpt-playgroundInteractively test any ChainGPT API endpoint. Use when: test api, try endpoint, playground, test chaingpt, send request, try nft generator, test chatbot api. Lets you pick a product, set parameters, send real API requests, and see responses./chaingpt-updateCheck for and apply updates to the ChainGPT skill. Use when: update chaingpt, update skill, check for updates, latest version, outdated docs, new api features.Generated from the plugin's indexed repository (scottcjn/chaingpt-claude-skill) — no native marketplace selected
npx claudepluginhub p/scottcjn-chaingpt