[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GN1BPE2K6CPYY3E639RRCP":3,"skill-same:01M6GN1BPE2K6CPYY3E639RRCP":83},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":41,"linkOnly":42,"markdownContent":43,"markdownBody":44,"frontMatter":45,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":52,"ownerDescription":53,"updatedAt":54,"install":55,"resources":68},"01M6GN1BPE2K6CPYY3E639RRCP","debug",null,"Troubleshoot ChainGPT API errors and issues. Use when: chaingpt error, api not working, 401, 402, 403, 404, 429, insufficient credits, rate limit, streaming broken, nft stuck, chat history not working. Diagnoses the problem and provides the fix.","jiayaoqijia\u002Fcryptoskill","jiayaoqijia","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1453879?v=4","01M6GMYTX7Q7S504VC6E756ENR","YQ","01M6GMYV1QKJ1CC75MTTGT9PR0",81,"MIT","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fai-crypto\u002Fchaingpt-org-official-debug\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fai-crypto\u002Fchaingpt-org-official-debug\u002FSKILL.md",[],[5,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"when","troubleshoot","rate","rate limit","api errors","chaingpt","limit","errors","429","error","problem","nft","chat","credits","use","fix","broken","history","api","streaming","issues","2026-11-10 10:12:30",false,"---\nname: debug\ndescription: \"Troubleshoot ChainGPT API errors and issues. Use when: chaingpt error, api not working, 401, 402, 403, 404, 429, insufficient credits, rate limit, streaming broken, nft stuck, chat history not working. Diagnoses the problem and provides the fix.\"\n---\n\n# ChainGPT API Debug Companion\n\nYou 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.\n\n## Step 1: Gather Information\n\nAccept any of the following as input:\n- An error message or stack trace\n- An HTTP status code\n- A description of unexpected behavior\n- A code snippet that is not working\n\nIf the developer only provides a vague description, ask:\n1. Which ChainGPT product are you using? (LLM Chat, NFT Generator, Contract Generator, Contract Auditor, News)\n2. Are you using the SDK or raw REST API?\n3. What HTTP status code or error message are you seeing?\n\n## Step 2: Run Environment Checks\n\nBefore diagnosing the specific error, verify the developer's environment:\n\n```bash\n# Check presence only; never print any part of the key\nif [ -n \"${CHAINGPT_API_KEY:+set}\" ]; then\n  printf '%s\\n' 'CHAINGPT_API_KEY is set'\nelse\n  printf '%s\\n' 'CHAINGPT_API_KEY is not set'\nfi\n```\n\nDo not print key values or prefixes, ask the developer to paste a key, or enable shell tracing\u002Fverbose HTTP output for authenticated requests. If the key is not set, that is likely the root cause. Instruct:\n- Set the key: `export CHAINGPT_API_KEY=\"your-key-here\"`\n- Get a key at https:\u002F\u002Fapp.chaingpt.org\u002Fapidashboard\n\nIf using the SDK, also check:\n\n```bash\n# Check if SDK package is installed (JavaScript)\ncat package.json 2>\u002Fdev\u002Fnull | grep -E \"@chaingpt|chaingpt\"\n\n# Check Node.js version (SDK requires LTS)\nnode --version 2>\u002Fdev\u002Fnull\n\n# Check Python version (Python SDK requires 3.7+)\npython3 --version 2>\u002Fdev\u002Fnull\n\n# Check if Python SDK is installed\npip3 show chaingpt 2>\u002Fdev\u002Fnull\n```\n\n## Step 3: Diagnose by HTTP Status Code\n\n### 400 — Bad Request\n\n**Common causes and fixes:**\n\n1. **Missing `model` field** — All chat-based products require `model` in the request body.\n   - LLM Chat: `\"model\": \"general_assistant\"`\n   - Contract Generator: `\"model\": \"smart_contract_generator\"`\n   - Contract Auditor: `\"model\": \"smart_contract_auditor\"`\n\n2. **Missing `question` or `prompt`** — The primary input field is required.\n   - Chat products: `question` (string, non-empty)\n   - NFT Generator: `prompt` (string, non-empty)\n\n3. **Missing Content-Type header** — Must include `Content-Type: application\u002Fjson` for POST requests.\n\n4. **Invalid JSON body** — Validate JSON syntax. Common issue: trailing commas, unescaped quotes in contract code.\n\n5. **Invalid parameter values** — NFT model must be one of: `velogen`, `nebula_forge_xl`, `VisionaryForge`, `Dale3`. Steps must be within model-specific range.\n\n**Fix template:**\n```bash\n# Verify your request has the correct structure\ncurl -X POST \"https:\u002F\u002Fapi.chaingpt.org\u002Fchat\u002Fstream\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"model\":\"general_assistant\",\"question\":\"test\",\"chatHistory\":\"off\"}'\n```\n\n---\n\n### 401 — Unauthorized\n\n**Common causes and fixes:**\n\n1. **Missing Authorization header** — Must be: `Authorization: Bearer \u003Ckey>`\n2. **Wrong header format** — Must be `Bearer \u003Ckey>` not just `\u003Ckey>`, not `Token \u003Ckey>`, not `Api-Key \u003Ckey>`\n3. **Key expired or revoked** — Regenerate at https:\u002F\u002Fapp.chaingpt.org\u002Fapidashboard\n4. **Extra whitespace or newline in key** — Have the developer check the value locally in their secret manager and correct it without copying any part of the key into tool output or the conversation.\n5. **Key from wrong environment** — Ensure you are not using a different account's key\n\n**Quick test:**\n```bash\n# Minimal request to verify auth works\ncurl -s -o \u002Fdev\u002Fnull -w \"%{http_code}\" \\\n  -X GET \"https:\u002F\u002Fapi.chaingpt.org\u002Fnft\u002Fget-chains?testNet=false\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\"\n```\nIf this returns 200, the key is valid. If 401, regenerate at https:\u002F\u002Fapp.chaingpt.org\u002Fapidashboard.\n\n---\n\n### 402 \u002F 403 — Payment Required \u002F Forbidden\n\n**Cause:** Insufficient credits or credits exhausted.\n\n**Fixes:**\n1. Check your balance at https:\u002F\u002Fapp.chaingpt.org\n2. Top up credits at https:\u002F\u002Fapp.chaingpt.org\u002Faddcredits\n3. Get 15% bonus by paying with $CGPT token or enabling monthly auto-top-up\n4. 1,000 credits = $10 USD (1 credit = $0.01)\n\n**Cost reference for budgeting:**\n| Product | Cost per request |\n|---------|-----------------|\n| LLM Chat | 0.5 credits (1.0 with history) |\n| Contract Generator | 1 credit (2 with history) |\n| Contract Auditor | 1 credit (2 with history) |\n| NFT (VeloGen\u002FNebula\u002FVisionary) | 1 credit base |\n| NFT (Dale3) | 4.75-14.25 credits |\n| News | 1 credit per 10 records |\n\n---\n\n### 404 — Not Found\n\n**Cause:** Wrong endpoint URL.\n\n**Common mistakes and corrections:**\n\n| Wrong | Correct |\n|-------|---------|\n| `POST \u002Fchat` | `POST \u002Fchat\u002Fstream` |\n| `POST \u002Fllm` | `POST \u002Fchat\u002Fstream` with `model: \"general_assistant\"` |\n| `POST \u002Fnft` | `POST \u002Fnft\u002Fgenerate-image` |\n| `GET \u002Fnews\u002Ffeed` | `GET \u002Fnews` |\n| `POST \u002Faudit` | `POST \u002Fchat\u002Fstream` with `model: \"smart_contract_auditor\"` |\n| `POST \u002Fgenerate` | `POST \u002Fchat\u002Fstream` with `model: \"smart_contract_generator\"` |\n\n**Key point:** LLM Chat, Contract Generator, and Contract Auditor ALL use the same endpoint `POST \u002Fchat\u002Fstream`. Only the `model` field differs. There is no separate endpoint per product for chat-based services.\n\n**NFT endpoints:**\n- `POST \u002Fnft\u002Fgenerate-image` — Generate a single image\n- `POST \u002Fnft\u002Fgenerate-multiple` — Generate multiple images\n- `POST \u002Fnft\u002Fgenerate-nft` — Generate and prepare for minting\n- `POST \u002Fnft\u002FenhancePrompt` — Enhance a prompt\n- `GET \u002Fnft\u002Fget-chains?testNet=false` — List supported chains\n- `GET \u002Fnft\u002Fprogress\u002F{collectionId}` — Check generation progress\n- `POST \u002Fnft\u002Fmint` — Mint an NFT\n- `GET \u002Fnft\u002Fabi` — Get contract ABI\n\n---\n\n### 429 — Too Many Requests\n\n**Cause:** Rate limit exceeded (200 requests\u002Fminute per API key).\n\n**Fixes:**\n1. Implement exponential backoff:\n```javascript\nasync function withBackoff(fn, maxRetries = 3) {\n  for (let i = 0; i \u003C maxRetries; i++) {\n    try { return await fn(); }\n    catch (e) {\n      if (e.status === 429) {\n        const delay = Math.pow(2, i) * 1000;\n        console.log(`Rate limited. Retrying in ${delay}ms...`);\n        await new Promise(r => setTimeout(r, delay));\n        continue;\n      }\n      throw e;\n    }\n  }\n  throw new Error('Max retries exceeded');\n}\n```\n\n2. Check if multiple services or instances share the same API key — each key has its own 200\u002Fmin limit.\n3. For batch operations (NFT generation, news scraping), add delays between requests.\n4. Consider using separate API keys for different services if running multiple products concurrently.\n\n---\n\n### 5xx — Server Error\n\n**Cause:** ChainGPT infrastructure issue.\n\n**Fixes:**\n1. Retry with exponential backoff (1s, 2s, 4s delays)\n2. If persistent (>5 minutes), the service may be experiencing an outage\n3. Check ChainGPT status \u002F announcements\n4. Try a different product endpoint to see if the issue is isolated\n\n---\n\n## Step 4: Diagnose Product-Specific Issues\n\n### NFT Generation Stuck \u002F No Response\n\n**Symptom:** Request returns a collectionId but no image URL, or status stays \"processing\".\n\n**Diagnosis:**\n1. NFT generation is asynchronous for larger jobs. You must poll for progress:\n```bash\ncurl -X GET \"https:\u002F\u002Fapi.chaingpt.org\u002Fnft\u002Fprogress\u002F{collectionId}\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\"\n```\n2. Poll every 3-5 seconds. Large batches can take several minutes.\n3. If stuck for >5 minutes, the job may have failed. Try regenerating with fewer images or a simpler prompt.\n\n### Streaming Response Garbled or Incomplete\n\n**Symptom:** Streamed text appears as raw chunks, binary-looking data, or cuts off mid-response.\n\n**Diagnosis and fixes:**\n\nFor **axios**:\n```javascript\n\u002F\u002F WRONG — axios buffers the response\nconst res = await axios.post(url, data, { headers });\n\n\u002F\u002F CORRECT — set responseType to stream\nconst res = await axios.post(url, data, {\n  headers,\n  responseType: 'stream'\n});\nres.data.on('data', chunk => process.stdout.write(chunk.toString()));\n```\n\nFor **fetch**:\n```javascript\nconst res = await fetch(url, { method: 'POST', headers, body: JSON.stringify(data) });\nconst reader = res.body.getReader();\nconst decoder = new TextDecoder();\nwhile (true) {\n  const { done, value } = await reader.read();\n  if (done) break;\n  process.stdout.write(decoder.decode(value));\n}\n```\n\n**Best fix:** Use the SDK which handles streaming automatically:\n```javascript\nconst stream = await chat.createChatStream({ question: '...', chatHistory: 'off' });\nstream.on('data', chunk => process.stdout.write(chunk.toString()));\nstream.on('end', () => console.log('\\nDone'));\n```\n\n### Chat History Not Persisting\n\n**Symptom:** Follow-up questions do not reference previous context.\n\n**Checklist:**\n1. `chatHistory` must be set to `\"on\"` (string, not boolean)\n2. `sdkUniqueId` must be the same across all requests in the session — this is how the server identifies the conversation\n3. Each request with history enabled costs double (0.5 -> 1.0 for LLM, 1 -> 2 for Generator\u002FAuditor)\n4. If using the SDK, ensure you are reusing the same client instance or passing the same sdkUniqueId\n\n**Test:**\n```bash\n# Request 1 — establish context\ncurl -X POST \"https:\u002F\u002Fapi.chaingpt.org\u002Fchat\u002Fstream\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"model\":\"general_assistant\",\"question\":\"My name is Alice\",\"chatHistory\":\"on\",\"sdkUniqueId\":\"debug-session-1\"}'\n\n# Request 2 — test if context persists\ncurl -X POST \"https:\u002F\u002Fapi.chaingpt.org\u002Fchat\u002Fstream\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"model\":\"general_assistant\",\"question\":\"What is my name?\",\"chatHistory\":\"on\",\"sdkUniqueId\":\"debug-session-1\"}'\n```\n\n### Context Injection Not Working\n\n**Symptom:** Custom context\u002Fknowledge base data is not being used in responses.\n\n**Checklist:**\n1. `useCustomContext` must be set to `true` in the request\n2. `contextInjection` object must be provided with the context data\n3. Verify the context data is not exceeding size limits\n\n### News Returning Empty Results\n\n**Symptom:** GET \u002Fnews returns empty data array or no results.\n\n**Checklist:**\n1. `categoryId`, `subCategoryId`, and `tokenId` must be valid integers — check the reference docs for valid IDs\n2. When passing multiple IDs, use array format: `categoryId=5&categoryId=12` or `categoryId[]=5&categoryId[]=12`\n3. `searchQuery` is case-insensitive but must match actual news content\n4. Try without filters first to confirm the endpoint works:\n```bash\ncurl -X GET \"https:\u002F\u002Fapi.chaingpt.org\u002Fnews?limit=5\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\"\n```\n5. If that works, add filters back one at a time to find the problematic filter\n\n---\n\n## Step 5: Provide the Fix\n\nAfter identifying the issue:\n1. Explain what went wrong in one sentence\n2. Show the corrected code or command\n3. Explain why the fix works\n\n## Step 6: Offer to Verify\n\nAfter providing the fix, offer:\n\n> \"Want me to run a test request to verify the fix works?\"\n\nIf yes, construct a minimal cURL command that tests the specific fix and execute it. Confirm the response is successful before closing.\n\n## SDK Error Class Reference\n\nWhen debugging SDK-specific errors, these are the error classes to catch:\n\n**JavaScript:**\n| Product | Error Class |\n|---------|------------|\n| LLM Chatbot | `Errors.GeneralChatError` from `@chaingpt\u002Fgeneralchat` |\n| NFT Generator | `Errors.NftError` from `@chaingpt\u002Fnft` |\n| Contract Generator | `Errors.SmartContractGeneratorError` from `@chaingpt\u002Fsmartcontractgenerator` |\n| Contract Auditor | `Errors.SmartContractAuditorError` from `@chaingpt\u002Fsmartcontractauditor` |\n| AI News | `Errors.AINewsError` from `@chaingpt\u002Fainews` |\n\n**Python exceptions** (all from `chaingpt.exceptions`):\n- `AuthenticationError` — 401\n- `ValidationError` — 400\n- `InsufficientCreditsError` — 402\u002F403\n- `RateLimitError` — 429\n- `NotFoundError` — 404\n- `ServerError` — 5xx\n- `StreamingError` — streaming issues\n- `TimeoutError` — network timeout\n- `ConfigurationError` — invalid config\n","# ChainGPT API Debug Companion\n\nYou 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.\n\n## Step 1: Gather Information\n\nAccept any of the following as input:\n- An error message or stack trace\n- An HTTP status code\n- A description of unexpected behavior\n- A code snippet that is not working\n\nIf the developer only provides a vague description, ask:\n1. Which ChainGPT product are you using? (LLM Chat, NFT Generator, Contract Generator, Contract Auditor, News)\n2. Are you using the SDK or raw REST API?\n3. What HTTP status code or error message are you seeing?\n\n## Step 2: Run Environment Checks\n\nBefore diagnosing the specific error, verify the developer's environment:\n\n```bash\n# Check presence only; never print any part of the key\nif [ -n \"${CHAINGPT_API_KEY:+set}\" ]; then\n  printf '%s\\n' 'CHAINGPT_API_KEY is set'\nelse\n  printf '%s\\n' 'CHAINGPT_API_KEY is not set'\nfi\n```\n\nDo not print key values or prefixes, ask the developer to paste a key, or enable shell tracing\u002Fverbose HTTP output for authenticated requests. If the key is not set, that is likely the root cause. Instruct:\n- Set the key: `export CHAINGPT_API_KEY=\"your-key-here\"`\n- Get a key at https:\u002F\u002Fapp.chaingpt.org\u002Fapidashboard\n\nIf using the SDK, also check:\n\n```bash\n# Check if SDK package is installed (JavaScript)\ncat package.json 2>\u002Fdev\u002Fnull | grep -E \"@chaingpt|chaingpt\"\n\n# Check Node.js version (SDK requires LTS)\nnode --version 2>\u002Fdev\u002Fnull\n\n# Check Python version (Python SDK requires 3.7+)\npython3 --version 2>\u002Fdev\u002Fnull\n\n# Check if Python SDK is installed\npip3 show chaingpt 2>\u002Fdev\u002Fnull\n```\n\n## Step 3: Diagnose by HTTP Status Code\n\n### 400 — Bad Request\n\n**Common causes and fixes:**\n\n1. **Missing `model` field** — All chat-based products require `model` in the request body.\n   - LLM Chat: `\"model\": \"general_assistant\"`\n   - Contract Generator: `\"model\": \"smart_contract_generator\"`\n   - Contract Auditor: `\"model\": \"smart_contract_auditor\"`\n\n2. **Missing `question` or `prompt`** — The primary input field is required.\n   - Chat products: `question` (string, non-empty)\n   - NFT Generator: `prompt` (string, non-empty)\n\n3. **Missing Content-Type header** — Must include `Content-Type: application\u002Fjson` for POST requests.\n\n4. **Invalid JSON body** — Validate JSON syntax. Common issue: trailing commas, unescaped quotes in contract code.\n\n5. **Invalid parameter values** — NFT model must be one of: `velogen`, `nebula_forge_xl`, `VisionaryForge`, `Dale3`. Steps must be within model-specific range.\n\n**Fix template:**\n```bash\n# Verify your request has the correct structure\ncurl -X POST \"https:\u002F\u002Fapi.chaingpt.org\u002Fchat\u002Fstream\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"model\":\"general_assistant\",\"question\":\"test\",\"chatHistory\":\"off\"}'\n```\n\n---\n\n### 401 — Unauthorized\n\n**Common causes and fixes:**\n\n1. **Missing Authorization header** — Must be: `Authorization: Bearer \u003Ckey>`\n2. **Wrong header format** — Must be `Bearer \u003Ckey>` not just `\u003Ckey>`, not `Token \u003Ckey>`, not `Api-Key \u003Ckey>`\n3. **Key expired or revoked** — Regenerate at https:\u002F\u002Fapp.chaingpt.org\u002Fapidashboard\n4. **Extra whitespace or newline in key** — Have the developer check the value locally in their secret manager and correct it without copying any part of the key into tool output or the conversation.\n5. **Key from wrong environment** — Ensure you are not using a different account's key\n\n**Quick test:**\n```bash\n# Minimal request to verify auth works\ncurl -s -o \u002Fdev\u002Fnull -w \"%{http_code}\" \\\n  -X GET \"https:\u002F\u002Fapi.chaingpt.org\u002Fnft\u002Fget-chains?testNet=false\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\"\n```\nIf this returns 200, the key is valid. If 401, regenerate at https:\u002F\u002Fapp.chaingpt.org\u002Fapidashboard.\n\n---\n\n### 402 \u002F 403 — Payment Required \u002F Forbidden\n\n**Cause:** Insufficient credits or credits exhausted.\n\n**Fixes:**\n1. Check your balance at https:\u002F\u002Fapp.chaingpt.org\n2. Top up credits at https:\u002F\u002Fapp.chaingpt.org\u002Faddcredits\n3. Get 15% bonus by paying with $CGPT token or enabling monthly auto-top-up\n4. 1,000 credits = $10 USD (1 credit = $0.01)\n\n**Cost reference for budgeting:**\n| Product | Cost per request |\n|---------|-----------------|\n| LLM Chat | 0.5 credits (1.0 with history) |\n| Contract Generator | 1 credit (2 with history) |\n| Contract Auditor | 1 credit (2 with history) |\n| NFT (VeloGen\u002FNebula\u002FVisionary) | 1 credit base |\n| NFT (Dale3) | 4.75-14.25 credits |\n| News | 1 credit per 10 records |\n\n---\n\n### 404 — Not Found\n\n**Cause:** Wrong endpoint URL.\n\n**Common mistakes and corrections:**\n\n| Wrong | Correct |\n|-------|---------|\n| `POST \u002Fchat` | `POST \u002Fchat\u002Fstream` |\n| `POST \u002Fllm` | `POST \u002Fchat\u002Fstream` with `model: \"general_assistant\"` |\n| `POST \u002Fnft` | `POST \u002Fnft\u002Fgenerate-image` |\n| `GET \u002Fnews\u002Ffeed` | `GET \u002Fnews` |\n| `POST \u002Faudit` | `POST \u002Fchat\u002Fstream` with `model: \"smart_contract_auditor\"` |\n| `POST \u002Fgenerate` | `POST \u002Fchat\u002Fstream` with `model: \"smart_contract_generator\"` |\n\n**Key point:** LLM Chat, Contract Generator, and Contract Auditor ALL use the same endpoint `POST \u002Fchat\u002Fstream`. Only the `model` field differs. There is no separate endpoint per product for chat-based services.\n\n**NFT endpoints:**\n- `POST \u002Fnft\u002Fgenerate-image` — Generate a single image\n- `POST \u002Fnft\u002Fgenerate-multiple` — Generate multiple images\n- `POST \u002Fnft\u002Fgenerate-nft` — Generate and prepare for minting\n- `POST \u002Fnft\u002FenhancePrompt` — Enhance a prompt\n- `GET \u002Fnft\u002Fget-chains?testNet=false` — List supported chains\n- `GET \u002Fnft\u002Fprogress\u002F{collectionId}` — Check generation progress\n- `POST \u002Fnft\u002Fmint` — Mint an NFT\n- `GET \u002Fnft\u002Fabi` — Get contract ABI\n\n---\n\n### 429 — Too Many Requests\n\n**Cause:** Rate limit exceeded (200 requests\u002Fminute per API key).\n\n**Fixes:**\n1. Implement exponential backoff:\n```javascript\nasync function withBackoff(fn, maxRetries = 3) {\n  for (let i = 0; i \u003C maxRetries; i++) {\n    try { return await fn(); }\n    catch (e) {\n      if (e.status === 429) {\n        const delay = Math.pow(2, i) * 1000;\n        console.log(`Rate limited. Retrying in ${delay}ms...`);\n        await new Promise(r => setTimeout(r, delay));\n        continue;\n      }\n      throw e;\n    }\n  }\n  throw new Error('Max retries exceeded');\n}\n```\n\n2. Check if multiple services or instances share the same API key — each key has its own 200\u002Fmin limit.\n3. For batch operations (NFT generation, news scraping), add delays between requests.\n4. Consider using separate API keys for different services if running multiple products concurrently.\n\n---\n\n### 5xx — Server Error\n\n**Cause:** ChainGPT infrastructure issue.\n\n**Fixes:**\n1. Retry with exponential backoff (1s, 2s, 4s delays)\n2. If persistent (>5 minutes), the service may be experiencing an outage\n3. Check ChainGPT status \u002F announcements\n4. Try a different product endpoint to see if the issue is isolated\n\n---\n\n## Step 4: Diagnose Product-Specific Issues\n\n### NFT Generation Stuck \u002F No Response\n\n**Symptom:** Request returns a collectionId but no image URL, or status stays \"processing\".\n\n**Diagnosis:**\n1. NFT generation is asynchronous for larger jobs. You must poll for progress:\n```bash\ncurl -X GET \"https:\u002F\u002Fapi.chaingpt.org\u002Fnft\u002Fprogress\u002F{collectionId}\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\"\n```\n2. Poll every 3-5 seconds. Large batches can take several minutes.\n3. If stuck for >5 minutes, the job may have failed. Try regenerating with fewer images or a simpler prompt.\n\n### Streaming Response Garbled or Incomplete\n\n**Symptom:** Streamed text appears as raw chunks, binary-looking data, or cuts off mid-response.\n\n**Diagnosis and fixes:**\n\nFor **axios**:\n```javascript\n\u002F\u002F WRONG — axios buffers the response\nconst res = await axios.post(url, data, { headers });\n\n\u002F\u002F CORRECT — set responseType to stream\nconst res = await axios.post(url, data, {\n  headers,\n  responseType: 'stream'\n});\nres.data.on('data', chunk => process.stdout.write(chunk.toString()));\n```\n\nFor **fetch**:\n```javascript\nconst res = await fetch(url, { method: 'POST', headers, body: JSON.stringify(data) });\nconst reader = res.body.getReader();\nconst decoder = new TextDecoder();\nwhile (true) {\n  const { done, value } = await reader.read();\n  if (done) break;\n  process.stdout.write(decoder.decode(value));\n}\n```\n\n**Best fix:** Use the SDK which handles streaming automatically:\n```javascript\nconst stream = await chat.createChatStream({ question: '...', chatHistory: 'off' });\nstream.on('data', chunk => process.stdout.write(chunk.toString()));\nstream.on('end', () => console.log('\\nDone'));\n```\n\n### Chat History Not Persisting\n\n**Symptom:** Follow-up questions do not reference previous context.\n\n**Checklist:**\n1. `chatHistory` must be set to `\"on\"` (string, not boolean)\n2. `sdkUniqueId` must be the same across all requests in the session — this is how the server identifies the conversation\n3. Each request with history enabled costs double (0.5 -> 1.0 for LLM, 1 -> 2 for Generator\u002FAuditor)\n4. If using the SDK, ensure you are reusing the same client instance or passing the same sdkUniqueId\n\n**Test:**\n```bash\n# Request 1 — establish context\ncurl -X POST \"https:\u002F\u002Fapi.chaingpt.org\u002Fchat\u002Fstream\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"model\":\"general_assistant\",\"question\":\"My name is Alice\",\"chatHistory\":\"on\",\"sdkUniqueId\":\"debug-session-1\"}'\n\n# Request 2 — test if context persists\ncurl -X POST \"https:\u002F\u002Fapi.chaingpt.org\u002Fchat\u002Fstream\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"model\":\"general_assistant\",\"question\":\"What is my name?\",\"chatHistory\":\"on\",\"sdkUniqueId\":\"debug-session-1\"}'\n```\n\n### Context Injection Not Working\n\n**Symptom:** Custom context\u002Fknowledge base data is not being used in responses.\n\n**Checklist:**\n1. `useCustomContext` must be set to `true` in the request\n2. `contextInjection` object must be provided with the context data\n3. Verify the context data is not exceeding size limits\n\n### News Returning Empty Results\n\n**Symptom:** GET \u002Fnews returns empty data array or no results.\n\n**Checklist:**\n1. `categoryId`, `subCategoryId`, and `tokenId` must be valid integers — check the reference docs for valid IDs\n2. When passing multiple IDs, use array format: `categoryId=5&categoryId=12` or `categoryId[]=5&categoryId[]=12`\n3. `searchQuery` is case-insensitive but must match actual news content\n4. Try without filters first to confirm the endpoint works:\n```bash\ncurl -X GET \"https:\u002F\u002Fapi.chaingpt.org\u002Fnews?limit=5\" \\\n  -H \"Authorization: Bearer $CHAINGPT_API_KEY\"\n```\n5. If that works, add filters back one at a time to find the problematic filter\n\n---\n\n## Step 5: Provide the Fix\n\nAfter identifying the issue:\n1. Explain what went wrong in one sentence\n2. Show the corrected code or command\n3. Explain why the fix works\n\n## Step 6: Offer to Verify\n\nAfter providing the fix, offer:\n\n> \"Want me to run a test request to verify the fix works?\"\n\nIf yes, construct a minimal cURL command that tests the specific fix and execute it. Confirm the response is successful before closing.\n\n## SDK Error Class Reference\n\nWhen debugging SDK-specific errors, these are the error classes to catch:\n\n**JavaScript:**\n| Product | Error Class |\n|---------|------------|\n| LLM Chatbot | `Errors.GeneralChatError` from `@chaingpt\u002Fgeneralchat` |\n| NFT Generator | `Errors.NftError` from `@chaingpt\u002Fnft` |\n| Contract Generator | `Errors.SmartContractGeneratorError` from `@chaingpt\u002Fsmartcontractgenerator` |\n| Contract Auditor | `Errors.SmartContractAuditorError` from `@chaingpt\u002Fsmartcontractauditor` |\n| AI News | `Errors.AINewsError` from `@chaingpt\u002Fainews` |\n\n**Python exceptions** (all from `chaingpt.exceptions`):\n- `AuthenticationError` — 401\n- `ValidationError` — 400\n- `InsufficientCreditsError` — 402\u002F403\n- `RateLimitError` — 429\n- `NotFoundError` — 404\n- `ServerError` — 5xx\n- `StreamingError` — streaming issues\n- `TimeoutError` — network timeout\n- `ConfigurationError` — invalid config\n",{"name":5,"description":7},"main","3df1d0d67b30ff15236561f8c0f9f06d33f42dfd","skills\u002Fai-crypto\u002Fchaingpt-org-official-debug",17,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia","https:\u002F\u002Feth2030.com","Hardcore infra. Building @alt-research and applied cryptography.","2026-11-15 02:28:10",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add jiayaoqijia\u002Fcryptoskill --skill debug",{"tool":61,"command":62},"bunx","bunx skills add jiayaoqijia\u002Fcryptoskill --skill debug",{"tool":64,"command":65},"pnpm","pnpm dlx skills add jiayaoqijia\u002Fcryptoskill --skill debug","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fai-crypto\u002Fchaingpt-org-official-debug\u002FSKILL.md",true,[69,73,79],{"path":70,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":16},"LICENSE","许可证",1065,{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"SOURCE.md","REFERENCE","参考文档",364,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fai-crypto\u002Fchaingpt-org-official-debug\u002FSOURCE.md",{"path":80,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":81,"sourceHtmlUrl":82},"TRUST.auto.yaml",2058,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fai-crypto\u002Fchaingpt-org-official-debug\u002FTRUST.auto.yaml",[84,93,101,109,117,125],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":88,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":92},"01M7DTKCERMV0RNX3HZJP4CZ26","troves","Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say \"Troves\" explicitly.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-troves\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-troves\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":97,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":92},"01M7DTK6CJSMGC8KCQHGNYFZBD","trade","Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say \"swap\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-trade\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-trade\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":105,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":92},"01M7DTJZ6A0X4PAW3Y8W4J9K64","staking","Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say \"stake\" explicitly.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-staking\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-staking\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":113,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":92},"01M7DTJSDZJKCDMW7GHRF4BRH5","send","Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say \"pay 10 STRK to 0x...\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-send\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-send\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":121,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":92},"01M7DTJG1E480D51ZQ7WKDQ26K","portfolio","View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks \"what do I have\", \"show me everything\", \"how much am I worth\", \"my positions\", \"my investments\", \"rebalance my portfolio\", \"I want 50% ETH\", \"optimize my holdings\", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say \"portfolio\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-portfolio\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-portfolio\u002FSKILL.md",[],[],{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":129,"sourceHtmlUrl":130,"categories":131,"keywords":132,"publishedAt":92},"01M7DTJ7M8TE9R2N36HFBZDGVD","multi-swap","Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions \"two swaps\", \"three swaps\", \"swap X and Y at the same time\", or wants to convert multiple tokens in a single call.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-multi-swap\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-multi-swap\u002FSKILL.md",[],[]]