{"id":20031,"date":"2026-09-28T00:19:15","date_gmt":"2026-09-28T04:19:15","guid":{"rendered":"https:\/\/wp.glbgpt.com\/?p=20031"},"modified":"2026-09-28T00:19:17","modified_gmt":"2026-09-28T04:19:17","slug":"perplexity-api-tutorial","status":"publish","type":"post","link":"https:\/\/wp.glbgpt.com\/hub\/zh\/perplexity-api-tutorial","title":{"rendered":"Perplexity API \u6559\u7a0b\uff1a\u9010\u6b65\u6784\u5efa\u6e90\u63a5\u5730\u7b54\u6848"},"content":{"rendered":"<style>\n[class*=\"pat-\"]{box-sizing:border-box}\np.pat-p,ul.pat-list{font:17px\/1.8 system-ui,-apple-system,\"Segoe UI\",sans-serif;color:#243F46;margin:0 0 22px}\np.pat-eyebrow{font:750 12px\/1.5 system-ui,sans-serif;letter-spacing:.12em;color:#35756f;margin:0 0 22px}\nh2.pat-h2{font:750 30px\/1.28 system-ui,sans-serif;color:#173E48;border-top:1px solid #D5E1DB;padding-top:23px;margin:58px 0 22px;scroll-margin-top:24px}\nh3.pat-h3{font:700 22px\/1.4 system-ui,sans-serif;color:#245D56;margin:30px 0 14px}\n.pat-p a,.pat-list a,.pat-table a{color:#146B61;text-decoration:underline;text-underline-offset:3px}\n.pat-p code,.pat-list code,.pat-table code{font:.88em Consolas,monospace;overflow-wrap:anywhere;background:#EEF3EF;padding:2px 4px;border-radius:3px}\np.pat-quick{background:#F5EDDA;border-left:4px solid #B99749;padding:23px 26px}\np.pat-note{background:#EEF4EF;border-radius:10px;padding:20px 24px}\nul.pat-toc{background:#EEF4EF;padding:24px 24px 24px 46px;border-radius:10px;columns:2;column-gap:32px;font-size:15px}\n.pat-list li{margin:8px 0;break-inside:avoid}\nul.pat-checklist{background:#F7F2E8;border:1px solid #DFD1B2;border-radius:10px;padding:20px 24px 20px 46px}\nfigure.pat-table{display:block;max-width:100%;overflow-x:auto;border:1px solid #CEDDD5;border-radius:10px;margin:26px 0}\n.pat-table table{border-collapse:collapse;width:100%;min-width:610px;font:14px\/1.65 system-ui,sans-serif}\n.pat-table th{background:#215957;color:white;text-align:left;padding:14px 16px;font-weight:650}\n.pat-table td{padding:13px 16px;vertical-align:top;border-bottom:1px solid #DFE7DF}\n.pat-table tbody tr:nth-child(even){background:#F2F6F0}\n.pat-table td:first-child{font-weight:600}\npre.pat-code{max-width:100%;overflow-x:auto;white-space:pre;padding:24px;border-radius:10px;background:#142F3C;color:#ECF7EF;font:14px\/1.7 Consolas,monospace;margin:24px 0}\n.pat-code code{font:inherit;white-space:pre;overflow-wrap:normal}\nfigure.pat-image{margin:30px 0}.pat-image img{display:block;width:100%;height:auto;border-radius:12px}\n.pat-image figcaption{font:14px\/1.6 system-ui,sans-serif;color:#627773;margin-top:10px}\n@media(max-width:650px){p.pat-p,ul.pat-list{font-size:16px}h2.pat-h2{font-size:26px;margin-top:44px}h3.pat-h3{font-size:20px}ul.pat-toc{columns:1}pre.pat-code{padding:18px;font-size:13px}p.pat-quick{padding:18px}.pat-table th,.pat-table td{padding:11px 12px}}\n\n\/* Native image blocks: same presentation as the approved preview. *\/\nfigure.wp-block-image.pat-image{display:block;max-width:100%;margin:30px 0}\nfigure.wp-block-image.pat-official{width:100%;max-width:848px;margin:30px auto}\nfigure.pat-image>a{display:block}figure.pat-image img{display:block;width:100%;max-width:100%;height:auto;border-radius:12px}\nfigure.pat-image figcaption.wp-element-caption{font:14px\/1.6 system-ui,sans-serif;color:#627773;margin:10px 0 0;text-align:left}\n.pat-image figcaption a{color:#146B61;text-decoration:underline;text-underline-offset:3px}\n<\/style>\n\n\n\n<p class=\"pat-p pat-eyebrow wp-block-paragraph\">PERPLEXITY API \u00b7 Python \u6559\u7a0b \u00b7 2026<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u672c Perplexity API \u6559\u7a0b\u5c06\u5411\u60a8\u5c55\u793a\u5982\u4f55\u7f16\u5199\u4e00\u4e2a Python \u811a\u672c\uff0c\u8be5\u811a\u672c\u53ef\u8fd4\u56de\u5305\u542b\u53ef\u70b9\u51fb\u7f51\u9875\u6765\u6e90\u7684\u7b54\u6848\u3002\u4f7f\u7528 Agent API \u53d1\u9001\u95ee\u9898\u3001\u8bfb\u53d6\u7b54\u6848\u3001\u5c06\u7b54\u6848\u4e2d\u7684\u5f15\u7528\u6807\u8bb0\u4e0e\u6765\u6e90 ID \u8fdb\u884c\u5339\u914d\uff0c\u5e76\u5bfc\u51fa\u4e00\u4e2a\u53ef\u4f9b\u60a8\u67e5\u9605\u7684 Markdown \u6587\u4ef6\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u6211\u4eec\u5c06\u59cb\u7ec8\u56f4\u7ed5\u4e00\u4e2a\u95ee\u9898\u5c55\u5f00\u8ba8\u8bba\uff1a <em>\u4e00\u4e2a\u5c0f\u578b Python \u9879\u76ee\u5e94\u8be5\u5982\u4f55\u4f7f\u7528\u865a\u62df\u73af\u5883\u5e76\u7ba1\u7406\u4f9d\u8d56\u9879\uff1f<\/em> \u4ece\u4e00\u4e2a\u57fa\u672c\u8bf7\u6c42\u5f00\u59cb\uff0c\u7136\u540e\u6dfb\u52a0\u6e90\u6570\u636e\u89e3\u6790\u548c\u57df\u540d\u8fc7\u6ee4\u529f\u80fd\u3002\u60a8\u9700\u8981\u5177\u5907\u57fa\u672c\u7684 Python \u77e5\u8bc6\uff0c\u5e76\u62e5\u6709\u4e00\u4e2a\u5df2\u8bbe\u7f6e API \u8ba1\u8d39\u529f\u80fd\u7684 Perplexity \u5f00\u53d1\u8005\u8d26\u6237\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u5982\u679c\u4f60\u4e5f\u5728\u65e5\u5e38\u7684\u7814\u7a76\u548c\u5199\u4f5c\u4e2d\u4f7f\u7528\u4eba\u5de5\u667a\u80fd\uff0c, <a href=\"https:\/\/www.glbgpt.com\/perplexity?inviter=hub_content_perplexity&amp;login=1\">Perplexity \u4f4d\u4e8e GlobalGPT \u4e0a<\/a> \u53ef\u5728\u4e00\u4f53\u5316 AI \u5de5\u4f5c\u533a\u4e2d\u76f4\u63a5\u8bbf\u95ee\uff0c\u4ece\u800c\u51cf\u5c11\u4e86\u5728\u4e0d\u540c\u5de5\u5177\u4e4b\u95f4\u5207\u6362\u7684\u5fc5\u8981\u3002\u8be5\u7528\u6237\u5de5\u4f5c\u6d41\u4e0e\u672c\u6587\u4e2d\u4f7f\u7528\u7684\u5f00\u53d1\u8005\u5bc6\u94a5\u548c API \u8ba1\u8d39\u7cfb\u7edf\u662f\u5206\u5f00\u7684\u3002.<\/p>\n\n\n\n<p class=\"pat-p pat-quick wp-block-paragraph\"><strong>\u5feb\u901f\u56de\u7b54\uff1a<\/strong> \u4f7f\u7528 <code>\u5feb<\/code> \u7528\u4e8e\u9996\u4e2a\u57fa\u4e8e\u7f51\u7edc\u7684\u7b54\u6848\u7684\u4ee3\u7406\u9884\u8bbe\uff0c\u8bf7\u9605\u8bfb <code>response.output_text<\/code> \u67e5\u770b\u7b54\u6848\uff0c\u5e76\u9605\u8bfb <code>\u641c\u7d22\u7ed3\u679c<\/code> \u9879\u76ee\u5728 <code>response.output<\/code> \u7528\u4e8e\u5f15\u7528\u6765\u6e90\u3002\u6839\u636e\u8fd4\u56de\u503c\uff0c\u5c06\u6bcf\u4e2a\u5185\u8054\u6807\u8bb0\u4e0e\u76f8\u5e94\u7684\u6765\u6e90\u8fdb\u884c\u5339\u914d <code>id<\/code>. \u5f15\u7528\u610f\u5473\u7740\u201c\u8be5\u7b54\u6848\u6307\u5411\u4e86\u8fd9\u4e00\u7ed3\u679c\u201d\uff1b\u4f46\u8fd9\u5e76\u4e0d\u4fdd\u8bc1\u8be5\u9875\u9762\u80fd\u8bc1\u660e\u6bcf\u4e00\u9879\u8bba\u70b9\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\"><strong>\u72b6\u6001\u793a\u4f8b\uff1a<\/strong> \u8be5\u8bf7\u6c42\u8bed\u6cd5\u9075\u5faa\u622a\u81f3 2026 \u5e74 9 \u6708 28 \u65e5\u67e5\u9605\u7684\u5b98\u65b9\u6587\u6863\u3002\u5f15\u7528\u52a9\u624b\u5df2\u4f7f\u7528\u79bb\u7ebf\u6837\u672c\u6570\u636e\u8fdb\u884c\u4e86\u9a8c\u8bc1\uff1b\u672c\u6559\u7a0b\u4e2d\u672a\u6267\u884c\u4efb\u4f55\u4ed8\u8d39 API \u8bf7\u6c42\u3002\u56fe\u4e2d\u6240\u793a\u7684\u6e90\u8bb0\u5f55\u5747\u4e3a\u8bf4\u660e\u6027\u793a\u4f8b\u3002.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/www.glbgpt.com\/perplexity?inviter=hub_content_perplexity&amp;login=1\"><img alt=\"\" decoding=\"async\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2025\/10\/image-33.png\" class=\"wp-image-2306\"\/><\/a><\/figure>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-3e41869c wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-black-color has-text-color has-background has-link-color has-medium-font-size has-custom-font-size wp-element-button\" href=\"https:\/\/www.glbgpt.com\/perplexity?inviter=hub_content_perplexity&amp;login=1\" style=\"background-color:#fec33a;line-height:1\"><strong>\u7acb\u5373\u8bd5\u7528\u300a\u9739\u96f3\u6e38\u4fa0\u300b &gt;<\/strong><\/a><\/div>\n<\/div>\n\n\n\n<ul class=\"wp-block-list pat-list pat-toc\">\n<li><a href=\"#api-choice\">\u5e94\u8be5\u4f7f\u7528\u54ea\u79cd Perplexity API\uff1f<\/a><\/li>\n\n\n\n<li><a href=\"#setup\">\u6b65\u9aa4 1\uff1a\u83b7\u53d6 API \u5bc6\u94a5\u5e76\u914d\u7f6e Python<\/a><\/li>\n\n\n\n<li><a href=\"#first-request\">\u6b65\u9aa4 2\uff1a\u53d1\u9001\u60a8\u7684\u7b2c\u4e00\u4e2a\u6e90\u6781\u63a5\u5730\u8bf7\u6c42<\/a><\/li>\n\n\n\n<li><a href=\"#sources\">\u7b2c 3 \u6b65\uff1a\u63d0\u53d6\u7b54\u6848\u5e76\u5339\u914d\u5176\u6765\u6e90<\/a><\/li>\n\n\n\n<li><a href=\"#filters\">\u7b2c 4 \u6b65\uff1a\u4f7f\u7528\u641c\u7d22\u7b5b\u9009\u6761\u4ef6\u4f18\u5316\u7b54\u6848<\/a><\/li>\n\n\n\n<li><a href=\"#export\">\u7b2c 5 \u6b65\uff1a\u4fdd\u5b58\u5305\u542b\u53ef\u70b9\u51fb\u6765\u6e90\u7684\u5b8c\u6574\u7b54\u6848<\/a><\/li>\n\n\n\n<li><a href=\"#advanced\">\u6d41\u5f0f\u8f93\u51fa\u548c\u7ed3\u6784\u5316\u8f93\u51fa<\/a><\/li>\n\n\n\n<li><a href=\"#cost-errors\">\u8d39\u7528\u4e0e\u5e38\u89c1\u9519\u8bef<\/a><\/li>\n\n\n\n<li><a href=\"#migration\">\u4ece\u65e7\u7248 Sonar \u6559\u7a0b\u8fc7\u6e21<\/a><\/li>\n\n\n\n<li><a href=\"#faq\">\u5e38\u89c1\u95ee\u9898<\/a><\/li>\n<\/ul>\n\n\n\n<h2 id=\"api-choice\" class=\"wp-block-heading pat-h2\">Perplexity API \u6559\u7a0b\uff1a\u9009\u62e9\u5408\u9002\u7684 API<\/h2>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u8fd9\u4e9b\u662f\u5f00\u53d1\u8005\u63a5\u53e3\u3002\u804a\u5929\u4ea7\u54c1\u53ef\u80fd\u4f1a\u4ee5\u4e0d\u540c\u7684\u65b9\u5f0f\u5c01\u88c5\u7c7b\u4f3c\u7684\u529f\u80fd\uff1b\u6211\u4eec\u5bf9 <a href=\"https:\/\/www.glbgpt.com\/hub\/what-are-the-main-features-of-perplexity-ai\/\">\u300aPerplexity\u300b\u7684\u6e38\u620f\u7279\u8272<\/a> \u63cf\u8ff0\u4e86\u9762\u5411\u7528\u6237\u7684\u4f53\u9a8c\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">Perplexity\u7684 <a href=\"https:\/\/docs.perplexity.ai\/docs\/getting-started\/quickstart\">\u5b98\u65b9 API \u5feb\u901f\u5165\u95e8<\/a> \u6839\u636e\u9700\u8981\u5b8c\u6210\u7684\u5de5\u4f5c\u6765\u5bf9\u5f00\u53d1\u4ea7\u54c1\u8fdb\u884c\u5206\u7c7b\u3002\u9009\u62e9\u80fd\u591f\u751f\u6210\u5e94\u7528\u7a0b\u5e8f\u5b9e\u9645\u6240\u9700\u6570\u636e\u7684\u6700\u5c0f\u5de5\u4f5c\u533a\u3002.<\/p>\n\n\n\n<figure class=\"wp-block-table pat-table\"><table><thead><tr><th>\u5e94\u7528\u7a0b\u5e8f\u63a5\u53e3<\/th><th>\u6700\u5408\u9002<\/th><th>\u60a8\u7684\u4ee3\u7801\u63a5\u6536\u5230\u7684\u5185\u5bb9<\/th><\/tr><\/thead><tbody><tr><td><strong>\u4ee3\u7406<\/strong><\/td><td>\u57fa\u4e8e\u7f51\u7edc\u641c\u7d22\u6216\u5176\u4ed6\u5de5\u5177\u5f97\u51fa\u7684\u5b8c\u6574\u7b54\u6848<\/td><td>\u952e\u5165\u7684\u8f93\u51fa\u9879\u3001\u7b54\u6848\u6587\u672c\u548c\u641c\u7d22\u7ed3\u679c\u8bb0\u5f55<\/td><\/tr><tr><td><strong>\u641c\u7d22<\/strong><\/td><td>\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u5c06\u81ea\u52a8\u5bf9\u7ed3\u679c\u8fdb\u884c\u6392\u5e8f\u3001\u7b5b\u9009\u6216\u6c47\u603b<\/td><td>\u65e0\u9700\u8ba9Perplexity\u5199\u51fa\u6700\u7ec8\u7b54\u6848\u7684\u641c\u7d22\u7ed3\u679c<\/td><\/tr><tr><td><strong>\u8def\u7531\u5668<\/strong><\/td><td>\u5c06\u8bf7\u6c42\u8def\u7531\u5230\u5408\u9002\u7684\u6a21\u578b<\/td><td>\u901a\u8fc7\u8def\u7531\u5668\u9009\u5b9a\u7684\u793a\u4f8b\u54cd\u5e94<\/td><\/tr><tr><td><strong>\u5d4c\u5165<\/strong><\/td><td>\u8bed\u4e49\u68c0\u7d22\u4e0e RAG \u7d22\u5f15<\/td><td>\u7528\u4e8e\u81ea\u5b9a\u4e49\u641c\u7d22\u56fe\u5c42\u7684\u77e2\u91cf\u56fe<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u672c\u6559\u7a0b\u9009\u62e9\u201cAgent\u201d\uff0c\u662f\u56e0\u4e3a\u60a8\u60f3\u8981\u7684\u7ed3\u679c\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u7b54\u6848\u53ca\u5176\u6765\u6e90\u3002\u5173\u4e8e\u66f4\u5e7f\u6cdb\u7684\u7814\u7a76\u5de5\u4f5c\u6d41\u7a0b\uff0c\u8bf7\u53c2\u9605\u6211\u4eec\u7684\u6307\u5357\uff1a <a href=\"https:\/\/www.glbgpt.com\/hub\/how-to-use-perplexity-for-research\/\">\u5c06Perplexity\u7528\u4e8e\u7814\u7a76<\/a>.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\"><strong>\u5173\u4e8e Sonar\uff1a<\/strong> \u5f53\u524d\u7684 <a href=\"https:\/\/docs.perplexity.ai\/docs\/agent-api\/migrate-from-sonar\/overview\">\u8fc1\u79fb\u6982\u8ff0<\/a> \u6307\u51fa Sonar \u4ee3\u7801\u8865\u5168\u529f\u80fd\u4ecd\u53d7\u652f\u6301\uff0c\u5e76\u5efa\u8bae\u6240\u6709\u65b0\u9879\u76ee\u4f7f\u7528 Agent\u3002\u56e0\u6b64\uff0c\u672c\u6559\u7a0b\u5c06\u4f7f\u7528 Agent\u3002\u8bf7\u4e0d\u8981\u4ec5\u56e0\u65e7\u6559\u7a0b\u4e2d\u63d0\u5230\u7684\u622a\u6b62\u65e5\u671f\uff0c\u5c31\u63a8\u65ad\u65e7\u7684\u96c6\u6210\u529f\u80fd\u5df2\u505c\u6b62\u5de5\u4f5c\u3002.<\/p>\n\n\n\n<h2 id=\"setup\" class=\"wp-block-heading pat-h2\">\u6b65\u9aa4 1\uff1a\u83b7\u53d6 API \u5bc6\u94a5\u5e76\u914d\u7f6e Python<\/h2>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u521b\u5efa\u5bc6\u94a5\u5e76\u51c6\u5907\u8ba1\u8d39<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\"><a href=\"https:\/\/console.perplexity.ai\/\">\u6253\u5f00 Perplexity API \u63a7\u5236\u53f0<\/a>, \u9009\u62e9\u6216\u521b\u5efa\u60a8\u8981\u4f7f\u7528\u7684\u9879\u76ee\uff0c\u914d\u7f6e API \u8ba1\u8d39\uff0c\u5e76\u521b\u5efa\u4e00\u4e2a\u5bc6\u94a5\u3002\u8bf7\u5c06\u8be5\u5bc6\u94a5\u4fdd\u5b58\u5728\u670d\u52a1\u5668\u7aef\u3002\u5f00\u53d1\u8005 API \u7684\u8ba1\u8d39\u4e0e\u7528\u6237\u8ba2\u9605\u5206\u5f00\u7ed3\u7b97\uff1b\u5728\u53d1\u9001\u8bf7\u6c42\u524d\uff0c\u8bf7\u5148\u67e5\u770b\u60a8\u7684\u9879\u76ee\u4f59\u989d\u3002.<\/p>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u5b89\u88c5\u5b98\u65b9 SDK<\/h3>\n\n\n\n<pre class=\"wp-block-code pat-code\"><code>python -m venv .venv\n\n# macOS\/Linux\uff1a\u8bf7\u9009\u62e9\u6b64\u6fc0\u6d3b\u547d\u4ee4\nsource .venv\/bin\/activate\n\n# Windows PowerShell\uff1a\u8bf7\u6539\u7528\u6b64\u547d\u4ee4\n.venv\\Scripts\\Activate.ps1\n\npython -m pip install --upgrade perplexityai<\/code><\/pre>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u8bf7\u4f7f\u7528 Python 3.10 \u6216\u66f4\u9ad8\u7248\u672c\u8fd0\u884c\u4ee5\u4e0b\u4ee3\u7801\u3002\u8bf7\u4f7f\u7528\u9002\u7528\u4e8e\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684\u547d\u4ee4\u6fc0\u6d3b\u73af\u5883\uff0c\u7136\u540e\u5b89\u88c5 SDK\u3002\u5982\u679c PowerShell \u963b\u6b62\u4e86\u73af\u5883\u7684\u6fc0\u6d3b\uff0c\u8bf7\u4f7f\u7528 <code>.venv\\Scripts\\python.exe<\/code> \u4ee3\u66ff <code>\u87d2\u86c7<\/code> \u7528\u4e8e\u5b89\u88c5\u548c\u811a\u672c\u6267\u884c\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u5305\u540d\u662f <code>perplexityai<\/code>, \uff0c\u800c Python \u7684\u5bfc\u5165\u8bed\u53e5\u662f <code>\u8ff7\u832b<\/code>. \u8bf7\u4f7f\u7528\u865a\u62df\u73af\u5883\uff0c\u4ee5\u514d\u672c\u6559\u7a0b\u7684\u4f9d\u8d56\u9879\u5f71\u54cd\u5176\u4ed6\u9879\u76ee\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u8be5\u793a\u4f8b\u91c7\u7528\u4e86\u4e00\u4e2a\u7f16\u7a0b\u95ee\u9898\uff0c\u56e0\u4e3a\u5176\u7ed3\u8bba\u53ef\u4ee5\u901a\u8fc7\u67e5\u9605\u7ef4\u62a4\u826f\u597d\u7684\u6587\u6863\u6765\u9a8c\u8bc1\u3002\u6211\u4eec\u7684\u6307\u5357 <a href=\"https:\/\/www.glbgpt.com\/hub\/is-perplexity-good-for-coding\/\">Perplexity \u7528\u4e8e\u7f16\u7801<\/a> \u89e3\u91ca\u4e86\u7814\u7a76\u652f\u6301\u4e0e\u81ea\u5df1\u6d4b\u8bd5\u4ee3\u7801\u4e4b\u95f4\u7684\u5173\u7cfb\u3002.<\/p>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u5c06 API \u5bc6\u94a5\u8bbe\u7f6e\u4e3a\u73af\u5883\u53d8\u91cf<\/h3>\n\n\n\n<pre class=\"wp-block-code pat-code\"><code># macOS\/Linux\nexport PERPLEXITY_API_KEY=\"your-key-here\"\n\n# Windows PowerShell\n$env:PERPLEXITY_API_KEY = \"your-key-here\"<\/code><\/pre>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">SDK \u8bfb\u53d6 <code>perplexity_api_key<\/code> \u5728\u521b\u5efa\u5ba2\u6237\u7aef\u65f6\u3002\u8bf7\u52ff\u5c06\u5bc6\u94a5\u7c98\u8d34\u5230\u8bb0\u4e8b\u672c\u4e2d\u3001\u63d0\u4ea4\u5230 Git\uff0c\u6216\u53d1\u9001\u81f3\u6d4f\u89c8\u5668\u3002\u5982\u679c\u5728\u672c\u5730\u4f7f\u7528 .env \u6587\u4ef6\uff0c\u8bf7\u5c06\u8be5\u6587\u4ef6\u6392\u9664\u5728\u7248\u672c\u63a7\u5236\u4e4b\u5916\uff0c\u5e76\u901a\u8fc7\u60a8\u9009\u62e9\u7684\u73af\u5883\u53d8\u91cf\u5e93\u52a0\u8f7d\u5b83\u3002.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"848\" height=\"632\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-sdk-authentication.webp\" alt=\"Perplexity \u5b98\u65b9\u6587\u6863\uff0c\u5176\u4e2d\u4ecb\u7ecd\u4e86 Python SDK \u7684\u5b89\u88c5\u4ee5\u53ca PERPLEXITY_API_KEY \u73af\u5883\u53d8\u91cf\u3002.\" class=\"wp-image-20033\" srcset=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-sdk-authentication.webp 848w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-sdk-authentication-300x224.webp 300w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-sdk-authentication-16x12.webp 16w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-sdk-authentication-767x572.webp 767w\" sizes=\"(max-width: 848px) 100vw, 848px\" \/><\/figure>\n\n\n\n<h2 id=\"first-request\" class=\"wp-block-heading pat-h2\">\u6b65\u9aa4 2\uff1a\u53d1\u9001\u60a8\u7684\u7b2c\u4e00\u4e2a\u6e90\u6781\u63a5\u5730\u8bf7\u6c42<\/h2>\n\n\n\n<p class=\"pat-p wp-block-paragraph\"><a href=\"https:\/\/docs.perplexity.ai\/docs\/agent-api\/quickstart\">Agent API \u5feb\u901f\u5165\u95e8<\/a> \u6587\u4ef6 <code>POST https:\/\/api.perplexity.ai\/v1\/agent<\/code>. \u5176 Python \u5ba2\u6237\u7aef\u4f7f\u7528 <code>client.responses.create()<\/code>. .......\u3002 <code>\u5feb<\/code> \u8be5\u9884\u8bbe\u9ed8\u8ba4\u542f\u7528\u4e86\u7f51\u9875\u641c\u7d22\u529f\u80fd\uff0c\u56e0\u6b64\u7b2c\u4e00\u4e2a\u793a\u4f8b\u7684\u7bc7\u5e45\u8f83\u77ed\u3002.<\/p>\n\n\n\n<pre class=\"wp-block-code pat-code\"><code>from perplexity import Perplexity\n\nclient = Perplexity()\n\nquestion = (\n    \"\u4e00\u4e2a\u5c0f\u578b Python \u9879\u76ee\u5e94\u8be5\u5982\u4f55\u4f7f\u7528\u865a\u62df\u73af\u5883\"\n    \"\u5e76\u7ba1\u7406\u4f9d\u8d56\u9879\uff1f\"\n)\n\nresponse = client.responses.create(\n    preset=\"fast\",\n    input=question,\n)\n\nprint(response.output_text)<\/code><\/pre>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u5c06\u4ee3\u7801\u7247\u6bb5\u4fdd\u5b58\u4e3a <code>first_request.py<\/code>, \u7136\u540e\u8fd0\u884c <code>python first_request.py<\/code> \u5728\u60a8\u8bbe\u7f6e\u5bc6\u94a5\u7684\u540c\u4e00\u7ec8\u7aef\u4e2d\u3002\u8c03\u7528\u6210\u529f\u65f6\u5e94\u663e\u793a\u975e\u7a7a\u7684\u54cd\u5e94\u6587\u672c\u3002\u5982\u679c\u60a8\u9700\u8981\u7ed3\u679c\u7684\u8bc1\u660e\uff0c\u8bf7\u7ee7\u7eed\u8fdb\u884c\u6e90\u4ee3\u7801\u63d0\u53d6\u6b65\u9aa4\uff1b\u4ec5\u51ed\u6587\u672c\u672c\u8eab\u5e76\u4e0d\u80fd\u7b97\u4f5c\u5b8c\u6574\u7684\u9a8c\u8bc1\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u4fbf\u5229\u6027\u5c5e\u6027 <code>\u8f93\u51fa\u6587\u672c<\/code> \u4f1a\u7ed9\u4f60\u6700\u7ec8\u7684\u7b54\u6848\u6587\u672c\u3002\u8bf7\u540c\u65f6\u4fdd\u7559\u6574\u4e2a\u54cd\u5e94\u5bf9\u8c61\uff1a\u6e90\u8bb0\u5f55\u548c\u4f7f\u7528\u8be6\u60c5\u90fd\u5305\u542b\u5728\u952e\u5165\u7684\u8f93\u51fa\u4e2d\uff0c\u800c\u4e0d\u4ec5\u4ec5\u662f\u5728\u6253\u5370\u51fa\u6765\u7684\u6bb5\u843d\u91cc\u3002.<\/p>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u4f7f\u7528 cURL \u53d1\u9001\u76f8\u540c\u7684\u8bf7\u6c42<\/h3>\n\n\n\n<pre class=\"wp-block-code pat-code\"><code>curl https:\/\/api.perplexity.ai\/v1\/agent \\\n  -H \"Authorization: Bearer $PERPLEXITY_API_KEY\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\n    \"preset\": \"fast\",\n    \"input\": \"\u4e00\u4e2a\u5c0f\u578b Python \u9879\u76ee\u5e94\u5982\u4f55\u4f7f\u7528\u865a\u62df\u73af\u5883\u5e76\u7ba1\u7406\u4f9d\u8d56\u9879\uff1f\"\n  }'<\/code><\/pre>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u6b64 cURL \u793a\u4f8b\u91c7\u7528\u9002\u7528\u4e8e macOS\/Linux \u6216\u4e0e Bash \u517c\u5bb9\u7684 shell \u7684 Bash \u8bed\u6cd5\u3002\u6bcf\u6b21\u8fd0\u884c\u90fd\u4f1a\u53d1\u8d77\u4e00\u6b21\u8ba1\u8d39\u8bf7\u6c42\u3002\u8bf7\u4ec5\u5728\u9700\u8981\u5c06\u7aef\u70b9\u95ee\u9898\u4e0e Python \u95ee\u9898\u533a\u5206\u5f00\u6765\u65f6\u4f7f\u7528\u6b64\u793a\u4f8b\uff1b\u8bf7\u52ff\u4ec5\u4e3a\u4e86\u8ddf\u8fdb\u793a\u4f8b\u800c\u8fd0\u884c\u6bcf\u4e2a\u7248\u672c\u3002.<\/p>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u670d\u52a1\u5668\u7aef JavaScript \u7684\u7b49\u6548\u5b9e\u73b0<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">Node.js 18 \u53ca\u4ee5\u4e0a\u7248\u672c\u5305\u542b <code>fetch<\/code>, \uff0c\u56e0\u6b64\u670d\u52a1\u5668\u7aef\u7684\u70df\u96fe\u6d4b\u8bd5\u65e0\u9700\u989d\u5916\u5e93\u3002\u9605\u8bfb\u539f\u59cb\u4ee3\u7801 <code>\u8f93\u51fa<\/code> JSON \u54cd\u5e94\u4e2d\u7684\u9879\uff1bPython SDK \u63d0\u4f9b\u4e86\u4e00\u4e2a\u4fbf\u6377\u7684 <code>\u8f93\u51fa\u6587\u672c<\/code> accessor.<\/p>\n\n\n\n<pre class=\"wp-block-code pat-code\"><code>const res = await fetch(\"https:\/\/api.perplexity.ai\/v1\/agent\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PERPLEXITY_API_KEY}`,\n    \"Content-Type\": \"application\/json\"\n  },\n  body: JSON.stringify({\n    preset: \"fast\",\n    input: \"\u4e00\u4e2a\u5c0f\u578b Python \u9879\u76ee\u5e94\u8be5\u5982\u4f55\u4f7f\u7528\u865a\u62df\u73af\u5883\u5e76\u7ba1\u7406\u4f9d\u8d56\u9879\uff1f\"\n  })\n});\nif (!res.ok) throw new Error(`Perplexity HTTP ${res.status}`);\nconsole.log(await res.json());<\/code><\/pre>\n\n\n\n<h2 id=\"sources\" class=\"wp-block-heading pat-h2\">\u7b2c 3 \u6b65\uff1a\u63d0\u53d6\u7b54\u6848\u5e76\u5339\u914d\u5176\u6765\u6e90<\/h2>\n\n\n\n<p class=\"pat-p wp-block-paragraph\"><a href=\"https:\/\/docs.perplexity.ai\/docs\/agent-api\/migrate-from-sonar\/how-to#inline-citations\">\u5b98\u65b9\u5f15\u7528\u6307\u5357<\/a> \u5c06\u6563\u6587\u4e0e\u5176\u8bc1\u636e\u8bb0\u5f55\u533a\u5206\u5f00\u6765\u3002\u8d44\u6599\u4ee5\u4e00\u79cd\u2026\u2026\u7684\u5f62\u5f0f\u51fa\u73b0\u3002 <code>\u8f93\u51fa<\/code> \u7c7b\u578b\u4e3a...\u7684\u9879 <code>\u641c\u7d22\u7ed3\u679c<\/code>. \u9605\u8bfb\u8be5\u6761\u76ee\u7684 <code>\u7ed3\u679c<\/code> \u5e76\u5c06\u6bcf\u4e2a\u5f15\u7528\u6807\u8bb0\u4e0e\u7ed3\u679c\u4e2d\u7684 <code>id<\/code>. \u6bcf\u4e2a\u7ed3\u679c\u90fd\u6709\u4e00\u4e2a\u6807\u9898\u548c\u4e00\u4e2a URL\uff1b\u5728\u663e\u793a\u7ed3\u679c\u4e4b\u524d\uff0c\u9700\u5148\u5904\u7406\u7f3a\u5931\u7684\u503c\u3002.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"848\" height=\"880\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-inline-citations.webp\" alt=\"Perplexity \u5b98\u65b9\u6587\u6863\uff0c\u5176\u4e2d\u89e3\u91ca\u4e86\u7f16\u53f7\u5f15\u7528\u3001\u6e90\u7c7b\u578b\u5f15\u7528\u4ee5\u53ca\u5c06\u6807\u8bb0\u4e0e\u641c\u7d22\u7ed3\u679c ID \u8fdb\u884c\u5339\u914d\u7684\u65b9\u6cd5\u3002.\" class=\"wp-image-20034\" srcset=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-inline-citations.webp 848w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-inline-citations-289x300.webp 289w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-inline-citations-12x12.webp 12w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-inline-citations-767x796.webp 767w\" sizes=\"(max-width: 848px) 100vw, 848px\" \/><\/figure>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u6700\u540e\u8fd9\u4e00\u70b9\u5f88\u91cd\u8981\u3002\u4e0d\u8981\u5047\u8bbe\u5728\u5176\u4ed6\u5de5\u5177\u6dfb\u52a0\u4e86\u4e00\u9879\u5185\u5bb9\u540e\uff0c\u201c\u5f15\u7528 1\u201d\u603b\u662f\u6570\u7ec4\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20\u3002\u5e94\u5148\u6839\u636e ID \u5efa\u7acb\u67e5\u627e\u673a\u5236\uff0c\u7136\u540e\u518d\u786e\u5b9a\u7b54\u6848\u4e2d\u5b9e\u9645\u51fa\u73b0\u7684\u6807\u8bb0\u3002.<\/p>\n\n\n\n<pre class=\"wp-block-code pat-code\"><code>def field(obj, name, default=None):\n    return obj.get(name, default) if isinstance(obj, dict) else getattr(obj, name, default)\n\ndef source_index(output):\n    sources = {}\n    for item in output or []:\n    if field(item, \"type\") != \"search_results\":\n        continue\n    for result in field(item, \"results\", []) or []:\n            sid, url = field(result, \"id\"), field(result, \"url\")\n if sid is None:\n continue\n key = str(sid)\n if key in sources and field(sources[key], \"url\") != url:\n                raise ValueError(f\"\u6e90 ID {key} \u7684 URL \u51b2\u7a81\")\n sources[key] = result\n    return sources\n\nsources = source_index(response.output)\nprint(sources.get(\"7\"))  # \u8fd9\u662f\u4e00\u4e2a\u6e90 ID\uff0c\u800c\u975e\u6570\u7ec4\u7d22\u5f15 7<\/code><\/pre>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u4e0b\u9762\u7684\u5b8c\u6574\u811a\u672c\u53ef\u8bc6\u522b <code>[1]<\/code> \u548c <code>[web:1]<\/code>, \uff0c\u5373\u5e38\u7528\u9884\u8bbe\u7684\u5df2\u8bb0\u5f55\u5f15\u7528\u683c\u5f0f\u3002\u4e0a\u8ff0\u8f85\u52a9\u51fd\u6570\u65e2\u652f\u6301 SDK \u5bf9\u8c61\uff0c\u4e5f\u652f\u6301\u5b57\u5178\uff0c\u4e14\u4f1a\u62d2\u7edd\u5c06\u51b2\u7a81\u7684 URL \u5206\u914d\u7ed9\u540c\u4e00\u4e2a ID\u3002\u5b83\u4e0d\u4f1a\u91cd\u65b0\u7f16\u53f7\u7ed3\u679c\uff0c\u4e5f\u4e0d\u4f1a\u5bf9\u7f3a\u5931\u7684\u6765\u6e90\u8fdb\u884c\u63a8\u6d4b\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u5173\u4e8e\u5f15\u6587\u8d28\u91cf\u7684\u66f4\u5e7f\u6cdb\u8ba8\u8bba\uff0c\u8bf7\u53c2\u9605\u6211\u4eec\u7684 <a href=\"https:\/\/www.glbgpt.com\/hub\/perplexity-citation-accuracy\/\">Perplexity \u5f15\u7528\u51c6\u786e\u6027\u6307\u5357<\/a>. \u5f15\u7528\u662f\u4e00\u79cd\u5ba1\u8ba1\u8f68\u8ff9\uff1b\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u4ecd\u9700\u5236\u5b9a\u9488\u5bf9\u8fc7\u671f\u9875\u9762\u3001\u91cd\u590d URL \u548c\u4e0d\u53d7\u652f\u6301\u7684\u58f0\u660e\u7684\u5904\u7406\u7b56\u7565\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u4f8b\u5982\uff0c\u5982\u679c\u8fd4\u56de\u7684\u6570\u7ec4\u4e2d\u5305\u542b ID 2\uff0c\u540e\u9762\u7d27\u63a5\u7740\u662f ID 7\uff0c\u90a3\u4e48\u8be5\u6807\u8bb0 <code>[7]<\/code> \u5fc5\u987b\u94fe\u63a5\u5230 ID 7\u3002\u5982\u679c\u540c\u4e00 URL \u540c\u65f6\u51fa\u73b0\u5728 ID 7 \u548c ID 9 \u4e0b\uff0c\u4f60\u53ef\u4ee5\u53ea\u663e\u793a\u8be5 URL \u4e00\u6b21\uff0c\u540c\u65f6\u4fdd\u7559\u8fd9\u4e24\u4e2a ID\u3002\u5982\u679c ID 8 \u59cb\u7ec8\u672a\u51fa\u73b0\uff0c\u5219\u4fdd\u7559 <code>[8]<\/code> \u663e\u793a\u51fa\u6765\uff0c\u5e76\u5c06\u5176\u6807\u8bb0\u4e3a\u201c\u672a\u5339\u914d\u201d\u3002.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"597\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-citation-id-workflow-1024x597.webp\" alt=\"\u5373\u4f7f\u641c\u7d22\u7ed3\u679c\u5217\u8868\u4e2d\u6392\u5728\u7b2c\u4e00\u4f4d\u7684\u662f\u4e00\u6761\u4e0d\u540c\u7684\u7ed3\u679c\uff0c\u5f15\u7528 7 \u4ecd\u4f1a\u4e0e ID \u4e3a 7 \u7684\u641c\u7d22\u7ed3\u679c\u76f8\u5bf9\u5e94\u3002.\" class=\"wp-image-20035\" srcset=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-citation-id-workflow-1024x597.webp 1024w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-citation-id-workflow-300x175.webp 300w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-citation-id-workflow-768x448.webp 768w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-citation-id-workflow-18x10.webp 18w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-citation-id-workflow.webp 1440w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 id=\"filters\" class=\"wp-block-heading pat-h2\">\u7b2c 4 \u6b65\uff1a\u4f7f\u7528\u641c\u7d22\u7b5b\u9009\u6761\u4ef6\u4f18\u5316\u7b54\u6848<\/h2>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u4e00\u65e6\u57fa\u672c\u67e5\u8be2\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u5f53\u4f60\u7684\u95ee\u9898\u6709\u660e\u786e\u7684\u6743\u5a01\u8303\u56f4\u65f6\uff0c\u8bf7\u7f29\u5c0f\u641c\u7d22\u8303\u56f4\u3002\u5bf9\u4e8e Python \u6253\u5305\uff0c\u8bed\u8a00\u6587\u6863\u548c\u6253\u5305\u6307\u5357\u6bd4\u4efb\u610f\u7684\u6559\u7a0b\u66f4\u9002\u5408\u4f5c\u4e3a\u8d77\u70b9\u3002.<\/p>\n\n\n\n<pre class=\"wp-block-code pat-code\"><code>response = client.responses.create(\n    preset=\"fast\",\n    input=(\n \"\u4e00\u4e2a\u5c0f\u578b Python \u9879\u76ee\u5e94\u5982\u4f55\u4f7f\u7528\u865a\u62df\u73af\u5883 \"\n \"\u5e76\u7ba1\u7406\u4f9d\u8d56\u9879\uff1f\u8bf7\u5f15\u7528\u4f60\u6240\u9075\u5faa\u7684\u6307\u5357\u3002\"\n    ),\n    tools=[\n {\n \"type\": \"web_search\",\n \"filters\": {\n \"search_domain_filter\": [\n \"docs.python.org\",\n                    \"packaging.python.org\",\n ]\n },\n }\n    ],\n)<\/code><\/pre>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u8be5\u8fc7\u6ee4\u5668\u5e94\u4f4d\u4e8e\u7f51\u9875\u641c\u7d22\u5de5\u5177\u7684\u914d\u7f6e\u4e2d\u3002\u8fc1\u79fb\u6587\u6863\u4e2d\u8fd8\u63cf\u8ff0\u4e86 <code>search_recency_filter<\/code> \u9002\u7528\u4e8e\u5bf9\u65f6\u95f4\u654f\u611f\u7684\u95ee\u9898\u3002\u5f53\u95ee\u9898\u6d89\u53ca\u6700\u65b0\u53d1\u5e03\u7684\u6d88\u606f\u6216\u65b0\u95fb\u65f6\uff0c\u5e94\u91c7\u7528\u201c\u8fd1\u671f\u6027\u201d\u539f\u5219\uff1b\u5982\u679c\u9886\u57df\u548c\u65e5\u671f\u8303\u56f4\u8fc7\u4e8e\u72ed\u7a84\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u53ef\u7528\u8bc1\u636e\u4e0d\u8db3\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u82e5\u8981\u8be2\u95ee\u8fc7\u53bb\u4e00\u4e2a\u6708\u5185\u7684\u53d1\u5e03\u60c5\u51b5\uff0c\u8bf7\u6dfb\u52a0 <code>\"search_recency_filter\": \"month\"<\/code> \u65c1\u8fb9 <code>search_domain_filter<\/code>. \u5728\u865a\u62df\u73af\u5883\u793a\u4f8b\u4e2d\u8bf7\u52ff\u5305\u542b\u6b64\u5185\u5bb9\uff1a\u7a33\u5b9a\u7248\u6587\u6863\u7684\u53d1\u5e03\u65e5\u671f\u53ef\u80fd\u8f83\u65e9\u3002\u5982\u679c\u60a8\u4ece\u9884\u8bbe\u6a21\u578b\u5207\u6362\u5230\u76f4\u63a5\u9009\u62e9\u7684\u6a21\u578b\uff0c\u8bf7\u660e\u786e\u5305\u542b\u7f51\u7edc\u641c\u7d22\u5de5\u5177\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u5bf9\u6bd4\u7ecf\u8fc7\u8fc7\u6ee4\u548c\u672a\u7ecf\u8fc7\u6ee4\u7684\u7ed3\u679c\u3002\u5982\u679c\u7b54\u6848\u53d1\u751f\u53d8\u5316\uff0c\u8bf7\u8bb0\u5f55\u539f\u56e0\uff1a\u8fc7\u6ee4\u5668\u53ef\u80fd\u4f1a\u79fb\u9664\u6709\u7528\u7684\u4e0a\u4e0b\u6587\uff0c\u4e5f\u53ef\u80fd\u79fb\u9664\u4e86\u90a3\u4e9b\u5e72\u6270\u6a21\u578b\u7684\u4f4e\u6743\u5a01\u9875\u9762\u3002\u8fd9\u662f\u4e00\u9879\u8d28\u91cf\u51b3\u7b56\uff0c\u5e76\u4e0d\u4fdd\u8bc1\u5269\u4e0b\u7684\u6bcf\u4e2a\u9875\u9762\u90fd\u662f\u6b63\u786e\u7684\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u5982\u679c\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u53ea\u9700\u8981\u5e26\u6392\u540d\u7684\u94fe\u63a5\u548c\u6458\u8981\uff0c\u8bf7\u8c03\u7528 <a href=\"https:\/\/docs.perplexity.ai\/docs\/getting-started\/quickstart\">\u641c\u7d22 API<\/a> \u5e76\u4eb2\u81ea\u8fdb\u884c\u5408\u6210\u3002\u8fd9\u79cd\u5206\u79bb\u53ef\u4ee5\u4f7f\u5ba1\u67e5\u548c\u7f13\u5b58\u53d8\u5f97\u66f4\u52a0\u5bb9\u6613\u3002\u5982\u9700\u4e0e\u8c37\u6b4c\u8fdb\u884c\u66f4\u5e7f\u6cdb\u7684\u6bd4\u8f83\uff0c\u8bf7\u53c2\u9605 <a href=\"https:\/\/www.glbgpt.com\/hub\/how-is-perplexity-different-than-google\/\">Perplexity \u4e0e Google \u7684\u533a\u522b<\/a>.<\/p>\n\n\n\n<h2 id=\"export\" class=\"wp-block-heading pat-h2\">\u7b2c 5 \u6b65\uff1a\u4fdd\u5b58\u5305\u542b\u53ef\u70b9\u51fb\u6765\u6e90\u7684\u5b8c\u6574\u7b54\u6848<\/h2>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u5c06\u4ee5\u4e0b\u5185\u5bb9\u53e6\u5b58\u4e3a <code>perplexity_tutorial.py<\/code>. \u5b83\u662f\u4e00\u4e2a\u81ea\u5305\u542b\u7684\u5de5\u5177\uff1a\u5305\u542b\u6e90\u8f85\u52a9\u7a0b\u5e8f\uff0c\u5e94\u7528 Python \u6587\u6863\u57df\u8fc7\u6ee4\u5668\uff0c\u5c06\u5339\u914d\u7684\u5f15\u7528\u6807\u8bb0\u8f6c\u6362\u4e3a\u94fe\u63a5\uff0c\u5728\u4e0d\u4e22\u5931 ID \u7684\u60c5\u51b5\u4e0b\u5bf9\u91cd\u590d\u7684 URL \u8fdb\u884c\u5206\u7ec4\uff0c\u5e76\u5c06\u5b8c\u6574\u7684 SDK \u54cd\u5e94\u4e0e Markdown \u4e00\u8d77\u4fdd\u5b58\u3002.<\/p>\n\n\n\n<pre class=\"wp-block-code pat-code\"><code>from pathlib import Path\nfrom collections import defaultdict\nfrom urllib.parse import urlsplit\nimport json\nimport re\n\nQUESTION = (\n    \"How should a small Python project use virtual environments \"\n    \"and manage dependencies?\"\n)\n# Supports the documented &#91;1] and &#91;web:1] forms in prose answers.\nCITATION_RE = re.compile(r\"(?&lt;!!)\\&#91;(?:web:)?(\\d+)\\](?!\\()\")\n\ndef field(obj, name, default=None):\n    return obj.get(name, default) if isinstance(obj, dict) else getattr(obj, name, default)\n\ndef source_index(output):\n    sources = {}\n    for item in output or &#91;]:\n        if field(item, \"type\") != \"search_results\":\n            continue\n        for result in field(item, \"results\", &#91;]) or &#91;]:\n            sid, url = field(result, \"id\"), field(result, \"url\")\n            if sid is None:\n                continue\n            key = str(sid)\n            if key in sources and field(sources&#91;key], \"url\") != url:\n                raise ValueError(f\"Conflicting URLs for source ID {key}\")\n            sources&#91;key] = result\n    return sources\n\ndef safe_url(value):\n    if not isinstance(value, str):\n        return None\n    parsed = urlsplit(value)\n    if parsed.scheme not in (\"http\", \"https\") or not parsed.netloc:\n        return None\n    # Protect a Markdown angle-bracket destination.\n    return value.replace(\"&lt;\", \"%3C\").replace(\"&gt;\", \"%3E\").replace(\" \", \"%20\")\n\ndef md_label(value):\n    return re.sub(r\"(&#91;\\\\\\&#91;\\]&lt;&gt;])\", r\"\\\\\\1\", str(value).replace(\"\\n\", \" \"))\n\ndef export_markdown(answer, output, question=QUESTION):\n    sources = source_index(output)\n    cited = list(dict.fromkeys(CITATION_RE.findall(answer)))\n    missing = &#91;\n        sid for sid in cited\n        if sid not in sources or not safe_url(field(sources&#91;sid], \"url\"))\n    ]\n    def link(match):\n        sid = match.group(1)\n        url = safe_url(field(sources.get(sid, {}), \"url\"))\n        return f\"&#91;{match.group(0)&#91;1:-1]}](&lt;{url}&gt;)\" if url else match.group(0)\n\n    # Keep every ID when the same URL appears under different IDs.\n    grouped = defaultdict(list)\n    titles = {}\n    for sid in cited:\n        source = sources.get(sid, {})\n        url = safe_url(field(source, \"url\"))\n        if url:\n            grouped&#91;url].append(sid)\n            titles.setdefault(url, field(source, \"title\") or url)\n\n    lines = &#91;\"# Source-grounded answer\", \"\", question, \"\",\n             CITATION_RE.sub(link, answer), \"\", \"## Cited sources\", \"\"]\n    for url, ids in grouped.items():\n        lines.append(f\"- IDs {', '.join(ids)}: &#91;{md_label(titles&#91;url])}](&lt;{url}&gt;)\")\n    if missing:\n        lines.append(\"- Unmatched or unusable source IDs: \" + \", \".join(missing))\n    if not cited:\n        lines.append(\"- No recognized inline citations; evidence not verified.\")\n    lines.extend(&#91;\"\", \"Source links require review; matching IDs does not verify claims.\"])\n    return \"\\n\".join(lines) + \"\\n\"\n\ndef main():\n    from perplexity import Perplexity\n    response = Perplexity().responses.create(\n        preset=\"fast\",\n        input=QUESTION,\n        tools=&#91;{\"type\": \"web_search\", \"filters\": {\n            \"search_domain_filter\": &#91;\"docs.python.org\", \"packaging.python.org\"]\n        }}],\n    )\n    answer = response.output_text or \"\"\n    if not answer.strip():\n        raise RuntimeError(\"No answer text returned; inspect response status and errors.\")\n    Path(\"perplexity-response.json\").write_text(\n        response.model_dump_json(indent=2), encoding=\"utf-8\"\n    )\n    Path(\"perplexity-answer.md\").write_text(\n        export_markdown(answer, response.output), encoding=\"utf-8\"\n    )\n    print(\"Saved perplexity-answer.md and perplexity-response.json\")\n\nif __name__ == \"__main__\":\n    main()\n\n<\/code><\/pre>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u8fd0\u884c <code>python perplexity_tutorial.py<\/code> \u4ece\u4f60\u7684\u9879\u76ee\u76ee\u5f55\u4e2d\u3002\u5b83\u4f1a\u5199\u5165 <code>perplexity-answer.md<\/code> \u548c <code>perplexity-response.json<\/code> \u5c06\u8fd9\u4e9b\u6587\u4ef6\u4fdd\u5b58\u5230\u8be5\u4f4d\u7f6e\uff0c\u5e76\u7528\u5b83\u4eec\u66ff\u6362\u4e4b\u524d\u540c\u540d\u7684\u6587\u4ef6\u3002Markdown \u6587\u4ef6\u5305\u542b\u95ee\u9898\u3001\u76f8\u5173\u94fe\u63a5\u7684\u7b54\u6848\u3001\u5f15\u7528\u6765\u6e90\u4ee5\u53ca\u4efb\u4f55\u672a\u5339\u914d\u7684 ID\u3002JSON \u6587\u4ef6\u5219\u4fdd\u5b58\u8fd4\u56de\u7684\u8f93\u51fa\u7ed3\u679c\u53ca\u5176\u4f7f\u7528\u60c5\u51b5\uff0c\u4ee5\u4fbf\u8fdb\u884c\u8bca\u65ad\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u8be5\u89e3\u6790\u5668\u9488\u5bf9\u6563\u6587\u4e2d\u5df2\u8bb0\u5f55\u7684\u5355\u6807\u8bb0\u5f62\u5f0f\u3002\u5b83\u5e76\u975e\u4e00\u4e2a\u5b8c\u6574\u7684 Markdown \u89e3\u6790\u5668\uff1a\u5982\u679c\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u5904\u7406\u4efb\u610f\u683c\u5f0f\u7684 Markdown\u3001\u4ee3\u7801\u793a\u4f8b\u6216\u5f15\u7528\uff0c\u4f8b\u5982 <code>[1,2]<\/code>, \u6dfb\u52a0\u4e00\u4e2a\u652f\u6301\u8be5\u683c\u5f0f\u7684\u8bed\u6cd5\u611f\u77e5\u6e32\u67d3\u5668\u53ca\u5176\u6d4b\u8bd5\u7528\u4f8b\u3002\u4e0d\u8981\u5728\u4e0d\u62a5\u9519\u7684\u60c5\u51b5\u4e0b\u5bf9\u4e0d\u719f\u6089\u7684\u6807\u8bb0\u8fdb\u884c\u91cd\u65b0\u89e3\u91ca\u3002.<\/p>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u68c0\u67e5\u6240\u94fe\u63a5\u7684\u9875\u9762\u662f\u5426\u652f\u6301\u8be5\u7b54\u6848<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u8bf7\u6838\u5b9e\u6240\u5f15\u7528\u7684\u6587\u6863\u662f\u5426\u786e\u5b9e\u89e3\u91ca\u4e86\u73af\u5883\u9694\u79bb\u548c\u4f9d\u8d56\u9879\u5b89\u88c5\u3002Python \u4e3b\u9875\u7684\u94fe\u63a5\u4e0d\u5982\u76f8\u5173\u6587\u6863\u90e8\u5206\u6709\u7528\u3002\u5982\u679c\u67d0\u4e2a\u7b54\u6848\u63a8\u8350\u4e86\u7279\u5b9a\u7684\u547d\u4ee4\uff0c\u8bf7\u5728\u8fd0\u884c\u4e4b\u524d\u5148\u786e\u8ba4\u5176\u64cd\u4f5c\u7cfb\u7edf\u548c Python \u7248\u672c\u3002Mark \u8ba4\u4e3a\u6240\u5f15\u7528\u7684\u6587\u672c\u65e0\u6cd5\u652f\u6301\u5c06\u8be5\u95ee\u9898\u6807\u8bb0\u4e3a\u201c\u672a\u89e3\u51b3\u201d\u3002.<\/p>\n\n\n\n<h2 id=\"advanced\" class=\"wp-block-heading pat-h2\">\u6839\u636e\u9700\u8981\u6dfb\u52a0\u6d41\u5f0f\u6216\u7ed3\u6784\u5316\u8f93\u51fa<\/h2>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u6d41\u5a92\u4f53<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u6d41\u5f0f\u4f20\u8f93\u53ef\u6539\u5584\u804a\u5929\u754c\u9762\u7684\u611f\u77e5\u5ef6\u8fdf\u3002\u4ee3\u7406\u8fc1\u79fb\u6307\u5357\u4e2d\u8bb0\u5f55\u4e86\u8bf8\u5982\u4ee5\u4e0b\u8fd9\u7c7b\u6587\u672c\u589e\u91cf\u4e8b\u4ef6\uff1a <code>response.output_text.delta<\/code>. \u5728\u589e\u91cf\u6570\u636e\u5230\u8fbe\u65f6\u7acb\u5373\u6e32\u67d3\uff0c\u4f46\u4e5f\u8981\u6536\u96c6\u6700\u7ec8\u7684\u54cd\u5e94\u9879\uff0c\u4ee5\u4fbf\u5728\u7b54\u6848\u751f\u6210\u5b8c\u6210\u540e\uff0cUI \u80fd\u591f\u663e\u793a\u6765\u6e90\u5217\u8868\u3002\u4ec5\u9760\u6587\u672c\u6d41\u672c\u8eab\u5e76\u4e0d\u6784\u6210\u6765\u6e90\u5217\u8868\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u4f9b\u53c2\u8003\u3002\u8bf7\u4fdd\u7559\u9996\u4e2a\u5b8c\u6574\u6e90\u8bb0\u5f55\u7684\u975e\u6d41\u5f0f\u5bfc\u51fa\uff1b\u5728\u751f\u4ea7\u73af\u5883\u7684\u6d41\u5f0f\u5b9e\u73b0\u4e2d\uff0c\u8fd8\u5fc5\u987b\u6536\u96c6\u5de5\u5177\/\u8f93\u51fa\u4e8b\u4ef6\uff0c\u5e76\u5904\u7406\u4e2d\u65ad\u6216\u5931\u8d25\u7684\u8fd0\u884c\u3002.<\/p>\n\n\n\n<pre class=\"wp-block-code pat-code\"><code>stream = client.responses.create(\n    preset=\"fast\", input=question, stream=True\n)\nfor event in stream:\n    if event.type == \"response.output_text.delta\":\n print(event.delta, end=\"\", flush=True)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u7ed3\u6784\u5316\u8f93\u51fa<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u5f53\u4e0b\u6e38\u4ee3\u7801\u9700\u8981\u8bf8\u5982\u4ee5\u4e0b\u5b57\u6bb5\u65f6\uff0c\u8bf7\u4f7f\u7528\u7ed3\u6784\u5316\u54cd\u5e94\uff1a <code>\u7b54\u6848<\/code>, <code>confidence_note<\/code> \u548c <code>\u540e\u7eed\u95ee\u9898<\/code>. \u5c06\u6e90 ID \u4f5c\u4e3a\u5355\u72ec\u5b57\u6bb5\u4fdd\u7559\uff0c\u6216\u4fdd\u7559 Agent \u7684\u539f\u59cb\u8f93\u51fa\uff0c\u4ee5\u514d\u6a21\u5f0f\u63a9\u76d6\u76f8\u5173\u8bc1\u636e\u3002\u5728\u5de5\u4f5c\u6d41\u4e2d\u4f9d\u8d56\u8be5\u6a21\u5f0f\u4e4b\u524d\uff0c\u8bf7\u5148\u4f7f\u7528\u60a8\u81ea\u5df1\u7684\u6d4b\u8bd5\u7528\u4f8b\u5bf9\u6a21\u5f0f\u8fdb\u884c\u9a8c\u8bc1\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u8fc1\u79fb\u53c2\u8003\u4fdd\u7559\u4e86 <code>response_format<\/code> \u4e0e <code>type: \"json_schema\"<\/code> \u7528\u4e8e\u7ed3\u6784\u5316\u8f93\u51fa\u3002\u5b9a\u4e49\u5fc5\u586b\u5b57\u6bb5\uff0c\u5e76\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u7981\u6b62\u51fa\u73b0\u610f\u5916\u5c5e\u6027\u3002\u6a21\u5f0f\u6709\u6548\u6027\u68c0\u67e5\u5173\u6ce8\u7684\u662f\u7ed3\u6784\uff0c\u800c\u975e\u771f\u5b9e\u6027\uff1a\u6e90ID\u4ecd\u9700\u80fd\u89e3\u6790\u4e3a\u5b9e\u9645\u8fd4\u56de\u7684\u8bb0\u5f55\uff0c\u4e14\u7531\u6a21\u578b\u751f\u6210\u7684\u7f6e\u4fe1\u5ea6\u6807\u7b7e\u5e76\u975e\u51c6\u786e\u7387\u6307\u6807\u3002.<\/p>\n\n\n\n<h2 id=\"cost-errors\" class=\"wp-block-heading pat-h2\">Perplexity API \u8d39\u7528\u53ca\u5e38\u89c1\u9519\u8bef<\/h2>\n\n\n\n<p class=\"pat-p wp-block-paragraph\"><a href=\"https:\/\/docs.perplexity.ai\/docs\/getting-started\/pricing\">Perplexity\u7684\u5b98\u65b9\u5b9a\u4ef7\u9875\u9762<\/a>, \uff0c\u67e5\u9605\u4e8e2026\u5e749\u670828\u65e5\uff0c\u8be5\u89c4\u5219\u5c06\u4ee3\u7406\u6a21\u578b\u4ee4\u724c\u4e0e\u5de5\u5177\u8c03\u7528\u533a\u5206\u5f00\u6765\u3002\u4ee5\u4e0b\u662fUSD\u5de5\u5177\/\u641c\u7d22\u8d39\u7528\u3002\u8be5 <code>\u5feb<\/code> \u4ee3\u7406\u9884\u8bbe\u548c <code>search_type: \"fast\"<\/code> \u8fd9\u4e9b\u662f\u4e0d\u540c\u7684\u914d\u7f6e\u9009\u9879\uff1b\u8bf7\u52ff\u6839\u636e\u9884\u8bbe\u540d\u79f0\u63a8\u65ad\u641c\u7d22\u901f\u7387\u3002.<\/p>\n\n\n\n<figure class=\"wp-block-table pat-table\"><table><thead><tr><th>\u53ef\u8ba1\u8d39\u64cd\u4f5c<\/th><th>\u6bcf\u80a1\u7f8e\u5143<\/th><th>\u6bcf1,000\u7f8e\u5143<\/th><\/tr><\/thead><tbody><tr><td>\u4ee3\u7406\u6807\u51c6\u7f51\u9875\u641c\u7d22<\/td><td>$0.0025<\/td><td>$2.50<\/td><\/tr><tr><td>\u4ee3\u7406\u5feb\u901f\u641c\u7d22\u8c03\u7528<\/td><td>$0.001<\/td><td>$1.00<\/td><\/tr><tr><td>\u4ee3\u7406 URL \u83b7\u53d6<\/td><td>$0.0005<\/td><td>$0.50<\/td><\/tr><tr><td>\u641c\u7d22 API \u8bf7\u6c42\u6210\u529f<\/td><td>$0.005<\/td><td>$5.00<\/td><\/tr><tr><td>\u4f7f\u7528 Fast Search \u7684\u641c\u7d22 API<\/td><td>$0.001<\/td><td>$1.00<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"736\" height=\"1024\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-tool-search-pricing-736x1024.webp\" alt=\"Perplexity\u7684\u5b98\u65b9\u5b9a\u4ef7\u8868\uff0c\u5176\u4e2d\u5217\u51fa\u4e86Agent\u5de5\u5177\u8c03\u7528\u8d39\u7528\u4ee5\u53ca\u6bcf1,000\u6b21\u8bf7\u6c42\u7684\u641c\u7d22API\u8d39\u7528\u3002.\" class=\"wp-image-20036\" srcset=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-tool-search-pricing-736x1024.webp 736w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-tool-search-pricing-216x300.webp 216w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-tool-search-pricing-9x12.webp 9w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-tool-search-pricing-768x1068.webp 768w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/perplexity-api-official-tool-search-pricing.webp 848w\" sizes=\"(max-width: 736px) 100vw, 736px\" \/><\/figure>\n\n\n\n<p class=\"pat-p wp-block-paragraph\"><strong>\u4f8b\u5982<\/strong> 1,000 \u6b21\u6807\u51c6\u7f51\u9875\u641c\u7d22\u8c03\u7528\u52a0\u4e0a 1,000 \u6b21 URL \u83b7\u53d6\u7684\u8d39\u7528\u4e3a <strong>$3.00 \u5200\u5177\u8d39\u7528<\/strong> ($2.50 + $0.50)\uff0c\u4e0d\u5305\u62ec\u6a21\u578b\u4ee4\u724c\u6216\u5176\u4ed6\u8d39\u7528\u3002\u8fd9\u662f\u57fa\u4e8e\u5047\u8bbe\u7684\u5de5\u4f5c\u8d1f\u8f7d\uff0c\u5e76\u975e\u672c\u6559\u7a0b\u4e2d\u6d4b\u5f97\u7684\u5b9e\u9645\u6210\u672c\u3002\u5355\u4e2a\u4ee3\u7406\u8bf7\u6c42\u53ef\u80fd\u4f1a\u8c03\u7528\u591a\u4e2a\u5de5\u5177\u3002\u5982\u6709\u53ef\u7528\uff0c\u8bf7\u68c0\u67e5 <code>\u4f7f\u7528\u91cf.\u6210\u672c.\u603b\u6210\u672c<\/code> \u5728\u5df2\u5b8c\u6210\u7684\u7b54\u590d\u4e0a\u3002.<\/p>\n\n\n\n<figure class=\"wp-block-table pat-table\"><table><thead><tr><th>\u75c7\u72b6<\/th><th>\u9996\u5148\u5e94\u68c0\u67e5\u4ec0\u4e48<\/th><\/tr><\/thead><tbody><tr><td>401 \u6216 403<\/td><td>\u73af\u5883\u53d8\u91cf\u540d\u79f0\u3001\u5bc6\u94a5\u6709\u6548\u6027\u3001\u8d26\u6237\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u8bf7\u6c42\u662f\u5426\u5df2\u5230\u8fbe\u5f53\u524d\u7aef\u70b9\u3002.<\/td><\/tr><tr><td>\u8ba1\u8d39\u6216\u914d\u989d\u9519\u8bef<\/td><td>API \u914d\u989d\u3001\u652f\u4ed8\u8bbe\u7f6e\u3001\u6a21\u578b\/\u5de5\u5177\u8d39\u7528\u53ca\u8d26\u6237\u9650\u989d\u3002Perplexity \u6d88\u8d39\u8005\u5957\u9910\u5e76\u4e0d\u81ea\u52a8\u5305\u542b API \u914d\u989d\u3002.<\/td><\/tr><tr><td>429<\/td><td>\u901f\u7387\u9650\u5236\u548c\u91cd\u8bd5\u884c\u4e3a\u3002\u5e94\u91c7\u7528\u6709\u754c\u6307\u6570\u9000\u907f\u7b97\u6cd5\uff0c\u5e76\u907f\u514d\u76f2\u76ee\u91cd\u53d1\u5df2\u6210\u529f\u5904\u7406\u7684\u8bf7\u6c42\u3002.<\/td><\/tr><tr><td>\u8d85\u65f6<\/td><td>\u7f51\u7edc\u8def\u5f84\u3001\u63d0\u793a\u6846\u5927\u5c0f\u3001\u5de5\u5177\u6570\u91cf\u548c\u5ba2\u6237\u7aef\u8d85\u65f6\u8bbe\u7f6e\u3002\u5982\u679c SDK \u63d0\u4f9b\u4e86\u8bf7\u6c42 ID\uff0c\u5219\u8bb0\u5f55\u8be5 ID\uff0c\u4f46\u5207\u52ff\u8bb0\u5f55\u5bc6\u94a5\u3002.<\/td><\/tr><tr><td>\u8be5\u7b54\u6848\u6ca1\u6709\u5339\u914d\u7684\u6765\u6e90<\/td><td>\u68c0\u67e5\u539f\u6599 <code>response.output<\/code>, \uff0c\u5f15\u7528\u683c\u5f0f\u548c\u6765\u6e90ID\uff1b\u5e94\u5c06\u8be5\u7b54\u6848\u6807\u8bb0\u4e3a\u201c\u672a\u6838\u5b9e\u201d\uff0c\u800c\u975e\u634f\u9020\u94fe\u63a5\u3002.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u641c\u7d22 API \u4f1a\u5bf9\u6210\u529f\u7684\u8bf7\u6c42\u8fdb\u884c\u8ba1\u8d39\uff0c\u5305\u62ec\u90a3\u4e9b\u672a\u8fd4\u56de\u4efb\u4f55\u7ed3\u679c\u7684\u8bf7\u6c42\uff1b\u5176\u8bf7\u6c42\u4ef7\u683c\u4e0d\u5305\u542b\u989d\u5916\u7684\u4ee3\u5e01\u8d39\u7528\u3002\u4ee3\u7406\u6210\u672c\u53d6\u51b3\u4e8e\u6a21\u578b\u4ee3\u5e01\u548c\u5de5\u5177\u3002\u5728\u6bd4\u8f83\u7b54\u590d\u5de5\u4f5c\u6d41\u4e0e\u7eaf\u641c\u7d22\u5de5\u4f5c\u6d41\u65f6\uff0c\u8bf7\u5c06\u8fd9\u4e9b\u8ba1\u8d39\u5355\u4f4d\u533a\u5206\u5f00\u6765\u3002.<\/p>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u82e5\u8981\u6bd4\u8f83 API \u9884\u7b97\uff0c\u8bf7\u53c2\u9605\u6211\u4eec\u7684 <a href=\"https:\/\/www.glbgpt.com\/hub\/perplexity-api-cost-2025\/\">Perplexity API \u8d39\u7528\u6307\u5357<\/a> \u63d0\u4f9b\u4e86\u80cc\u666f\u4fe1\u606f\uff0c\u800c\u5f53\u524d\u8d39\u7387\u7684\u6743\u5a01\u6765\u6e90\u4ecd\u662f\u5b98\u65b9\u5b9a\u4ef7\u9875\u9762\u3002.<\/p>\n\n\n\n<h2 id=\"migration\" class=\"wp-block-heading pat-h2\">\u4ece\u65e7\u7248 Sonar \u6559\u7a0b\u8fc7\u6e21<\/h2>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u8bb8\u591a\u641c\u7d22\u7ed3\u679c\u4ecd\u663e\u793a\u65e7\u7248\u7684\u201c\u804a\u5929\u8865\u5168\u201d\u56fe\u6807\u3002\u5ba2\u670d\u4eba\u5458\u8fc1\u79fb\u6307\u5357\u91c7\u7528\u4e86\u76f4\u63a5\u7684\u6982\u5ff5\u6620\u5c04\u3002\u5982\u679c\u60a8\u6b63\u5728\u6bd4\u8f83\u6d88\u8d39\u8005\u6a21\u578b\u6807\u7b7e\u4e0e API \u9884\u8bbe\uff0c\u8bf7\u53c2\u9605\u6211\u4eec\u5173\u4e8e <a href=\"https:\/\/www.glbgpt.com\/hub\/what-llm-does-perplexity-use\/\">LLM Perplexity \u7684\u7528\u9014<\/a> \u63d0\u4f9b\u4e86\u80cc\u666f\u4fe1\u606f\uff0c\u4f46\u4e0d\u80fd\u66ff\u4ee3 Agent API \u6587\u6863\u3002.<\/p>\n\n\n\n<figure class=\"wp-block-table pat-table\"><table><thead><tr><th>\u8f83\u65e9\u7684\u58f0\u5450\u6a21\u5f0f<\/th><th>\u4ee3\u7406 API \u6a21\u5f0f<\/th><\/tr><\/thead><tbody><tr><td><code>\u4fe1\u606f<\/code><\/td><td><code>\u8f93\u5165<\/code><\/td><\/tr><tr><td><code>\u6a21\u578b<\/code><\/td><td><code>\u9884\u8bbe<\/code><\/td><\/tr><tr><td><code>choices[0].message.content<\/code><\/td><td><code>\u8f93\u51fa\u6587\u672c<\/code><\/td><\/tr><tr><td>\u8fc7\u65f6\u7684\u5f15\u7528\u6570\u7ec4\u5047\u8bbe<\/td><td><code>\u641c\u7d22\u7ed3\u679c<\/code> \u8f93\u51fa\u9879\u4e0e\u57fa\u4e8eID\u7684\u5339\u914d<\/td><\/tr><tr><td>\u8bf7\u6c42\u4e2d\u7684\u641c\u7d22\u53c2\u6570<\/td><td><code>tools=[{\"type\":\"web_search\",\"filters\":{...}}]<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u9605\u8bfb\u76f4\u64ad <a href=\"https:\/\/docs.perplexity.ai\/docs\/agent-api\/migrate-from-sonar\/overview\">\u8fc1\u79fb\u6982\u8ff0<\/a> \u548c <a href=\"https:\/\/docs.perplexity.ai\/docs\/agent-api\/migrate-from-sonar\/how-to\">\u8fc1\u79fb\u8be6\u60c5<\/a> \u5728\u4fee\u6539\u751f\u4ea7\u4ee3\u7801\u4e4b\u524d\u3002\u9884\u8bbe\u7684\u6620\u5c04\u4ec5\u4f5c\u4e3a\u8d77\u70b9\uff0c\u5e76\u4e0d\u4fdd\u8bc1\u65b0\u65e7\u6a21\u578b\u5728\u8d28\u91cf\u3001\u5ef6\u8fdf\u6216\u6210\u672c\u65b9\u9762\u5b8c\u5168\u4e00\u81f4\u3002.<\/p>\n\n\n\n<h2 id=\"faq\" class=\"wp-block-heading pat-h2\">\u5e38\u89c1\u95ee\u9898<\/h2>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">Perplexity API \u662f\u514d\u8d39\u7684\u5417\uff1f<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u6839\u636e\u5f53\u524d\u7684\u5feb\u901f\u5165\u95e8\u548c\u5b9a\u4ef7\u6587\u6863\uff0cAPI \u91c7\u7528\u6309\u91cf\u4ed8\u8d39\u6a21\u5f0f\u3002\u8bf7\u4e0d\u8981\u4ee5\u4e3a\u6d88\u8d39\u8005\u8ba2\u9605\u3001\u8bd5\u7528\u6216\u4fc3\u9500\u79ef\u5206\u5c31\u80fd\u8ba9\u6bcf\u6b21 API \u8c03\u7528\u90fd\u514d\u8d39\u3002.<\/p>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u4f7f\u7528\u8be5 API \u662f\u5426\u9700\u8981 Perplexity Pro\uff1f<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">API \u8bbf\u95ee\u6743\u9650\u548c\u6d88\u8d39\u8005 Pro \u5957\u9910\u662f\u4e24\u4e2a\u72ec\u7acb\u7684\u4ea7\u54c1\u3002\u8bf7\u4e3a\u8ba1\u5212\u4f7f\u7528\u7684\u5f00\u53d1\u8005\u8d26\u6237\u521b\u5efa API \u51ed\u636e\uff0c\u5e76\u67e5\u770b API \u8d26\u5355\u4fe1\u606f\u3002.<\/p>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u6211\u5e94\u8be5\u4f7f\u7528 Agent API \u8fd8\u662f Search API\uff1f<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u5f53\u60a8\u9700\u8981\u4e00\u4e2a\u9644\u6709\u6765\u6e90\u7684\u5b8c\u6574\u3001\u6709\u4f9d\u636e\u7684\u7b54\u6848\u65f6\uff0c\u8bf7\u9009\u62e9\u201c\u4ee3\u7406\u201d\u3002\u5f53\u60a8\u7684\u5e94\u7528\u9700\u8981\u81ea\u884c\u5904\u7406\u6392\u5e8f\u3001\u7b5b\u9009\u548c\u7efc\u5408\u65f6\uff0c\u8bf7\u9009\u62e9\u201c\u641c\u7d22\u201d\u3002\u5982\u679c\u60a8\u9700\u8981\u5bf9\u6bcf\u4e2a\u751f\u6210\u6b65\u9aa4\u8fdb\u884c\u4e25\u683c\u63a7\u5236\uff0c\u53ef\u4ee5\u5c06\u201c\u641c\u7d22\u201d\u4e0e\u60a8\u81ea\u5df1\u7684\u6a21\u578b\u7ed3\u5408\u4f7f\u7528\u3002.<\/p>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u6211\u53ef\u4ee5\u5728 JavaScript \u4e2d\u8c03\u7528 Perplexity \u5417\uff1f<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u662f\u7684\u3002\u8bf7\u4f7f\u7528\u4e0a\u6587\u63d0\u5230\u7684\u670d\u52a1\u5668\u7aef Node.js \u793a\u4f8b\u6216\u5b98\u65b9 JavaScript SDK\u3002\u5c06\u5bc6\u94a5\u4fdd\u5b58\u5728\u670d\u52a1\u5668\u4e0a\u3002\u5728\u8bfb\u53d6\u539f\u59cb JSON \u65f6\uff0c\u8bf7\u68c0\u67e5\u7c7b\u578b\u5316\u7684\u8f93\u51fa\u9879\uff0c\u5e76\u5e94\u7528\u76f8\u540c\u7684\u6e90 ID \u6620\u5c04\u89c4\u5219\u3002.<\/p>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">Perplexity\u7684\u5f15\u7528\u662f\u5426\u4e00\u5b9a\u6b63\u786e\uff1f<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u4e0d\u3002\u5f15\u7528\u4ec5\u544a\u77e5\u4f60\u8be5\u7b54\u6848\u6307\u5411\u7684\u662f\u54ea\u4e2a\u68c0\u7d22\u7ed3\u679c\u3002\u4f60\u7684\u7533\u8bf7\u6216\u8bc4\u5ba1\u4eba\u4ecd\u9700\u6838\u67e5\u8be5\u9875\u9762\u7684\u65f6\u6548\u6027\u3001\u6743\u5a01\u6027\uff0c\u4ee5\u53ca\u8be5\u9875\u9762\u662f\u5426\u786e\u5b9e\u652f\u6301\u8be5\u8bba\u70b9\u3002.<\/p>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">\u4e3a\u4ec0\u4e48\u6211\u7684\u89e3\u6790\u5668\u6ca1\u6709\u627e\u5230\u4efb\u4f55\u6765\u6e90\uff1f<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u68c0\u67e5\u539f\u59cb\u8f93\u51fa\u9879\u7684\u7c7b\u578b\uff0c\u786e\u8ba4\u7f51\u7edc\u641c\u7d22\u662f\u5426\u5df2\u6267\u884c\uff0c\u5e76\u68c0\u67e5\u60a8\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u5426\u4e0e\u9884\u8bbe\u7684\u5f15\u7528\u683c\u5f0f\u5339\u914d\u3002\u5982\u679c\u672a\u51fa\u73b0\u6807\u8bb0\uff0c\u8bf7\u5c06\u7b54\u6848\u4fdd\u5b58\u4e3a\u201c\u672a\u9a8c\u8bc1\u201d\uff0c\u5e76\u8c03\u67e5\u8be5\u8bf7\u6c42\uff0c\u800c\u4e0d\u662f\u6dfb\u52a0\u4e00\u4e2a\u731c\u6d4b\u7684\u94fe\u63a5\u3002.<\/p>\n\n\n\n<h3 class=\"wp-block-heading pat-h3\">GlobalGPT \u80fd\u5426\u66ff\u4ee3 Perplexity API \u5bc6\u94a5\uff1f<\/h3>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">GlobalGPT \u662f\u4e00\u4e2a\u9762\u5411\u65e5\u5e38 AI \u5e94\u7528\u7684\u5168\u80fd\u578b AI \u5de5\u4f5c\u533a\u3002\u5176\u8ba2\u9605\u548c\u6a21\u578b\u8bbf\u95ee\u4e0e Perplexity \u5f00\u53d1\u8005\u8d26\u6237\u3001API \u5bc6\u94a5\u53ca API \u79ef\u5206\u662f\u5206\u5f00\u7684\uff1b\u672c Python \u6559\u7a0b\u4f7f\u7528\u7684\u662f\u5f00\u53d1\u8005\u8d26\u6237\u3002.<\/p>\n\n\n\n<h2 id=\"checklist\" class=\"wp-block-heading pat-h2\">\u4e00\u4efd\u5b9e\u7528\u7684\u53d1\u5e03\u68c0\u67e5\u6e05\u5355<\/h2>\n\n\n\n<ul class=\"wp-block-list pat-list pat-checklist\">\n<li>\u521b\u5efa\u670d\u52a1\u5668\u7aef\u5bc6\u94a5\u5e76\u786e\u8ba4 API \u8ba1\u8d39\u3002.<\/li>\n\n\n\n<li>\u8fd0\u884c\u7cbe\u7b80\u7248 <code>\u5feb<\/code> \u5728\u6dfb\u52a0\u8fc7\u6ee4\u5668\u6216\u5f00\u59cb\u6d41\u5f0f\u4f20\u8f93\u4e4b\u524d\uff0c\u8bf7\u5148\u63d0\u4ea4\u8bf7\u6c42\u3002.<\/li>\n\n\n\n<li>\u8bf7\u4fdd\u5b58\u5b8c\u6574\u7684\u56de\u7b54\u5185\u5bb9\uff0c\u800c\u4e0d\u4ec5\u4ec5\u662f\u53ef\u89c1\u7684\u7b54\u6848\u6587\u672c\u3002.<\/li>\n\n\n\n<li>\u5c06\u5f15\u7528\u6807\u8bb0\u4e0e\u8fd4\u56de\u7684\u6765\u6e90ID\u8fdb\u884c\u5339\u914d\uff0c\u5e76\u5bf9\u672a\u5339\u914d\u7684\u6807\u8bb0\u8fdb\u884c\u6807\u8bb0\u3002.<\/li>\n\n\n\n<li>\u68c0\u67e5\u6240\u5f15\u7528\u7684\u9875\u9762\uff0c\u4ee5\u786e\u8ba4\u5176\u5bf9\u4e3b\u5f20\u7684\u652f\u6301\u6027\u3001\u65f6\u6548\u6027\u4ee5\u53ca\u662f\u5426\u5b58\u5728\u91cd\u590d\u7684URL\u3002.<\/li>\n\n\n\n<li>\u90e8\u7f72\u524d\uff0c\u8bf7\u91cd\u65b0\u68c0\u67e5\u751f\u4ea7\u73af\u5883\u4ee3\u7406\u3001\u5b9a\u4ef7\u53ca\u8fc1\u79fb\u6587\u6863\u3002.<\/li>\n<\/ul>\n\n\n\n<p class=\"pat-p wp-block-paragraph\">\u73b0\u5728\uff0c\u60a8\u5df2\u7ecf\u638c\u63e1\u4e86\u5b9e\u73b0\u53ef\u9760\u7684 Perplexity API \u96c6\u6210\u7684\u6838\u5fc3\u6a21\u5f0f\uff1a\u63d0\u51fa\u4e00\u4e2a\u9488\u5bf9\u6027\u95ee\u9898\uff0c\u8ba9\u4ee3\u7406 API \u8fdb\u884c\u641c\u7d22\uff0c\u5c06\u7b54\u6848\u4e0e\u8bc1\u636e\u5173\u8054\u5728\u4e00\u8d77\uff0c\u5e76\u786e\u4fdd\u6bcf\u6761\u5f15\u7528\u90fd\u80fd\u88ab\u8ffd\u6eaf\u3002\u5728\u6b64\u57fa\u7840\u4e0a\uff0c\u56f4\u7ed5\u76f8\u540c\u7684\u6e90 ID \u5de5\u4f5c\u6d41\uff0c\u6dfb\u52a0\u7f13\u5b58\u3001\u91cd\u8bd5\u4ee5\u53ca\u60a8\u81ea\u5df1\u7684\u5ba1\u6838\u89c4\u5219\u3002.<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\n    \"@context\": \"https:\\\/\\\/schema.org\",\n    \"@type\": \"FAQPage\",\n    \"mainEntity\": [\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Is the Perplexity API free?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"The APIs are pay-as-you-go according to the current quickstart and pricing documentation. Do not assume that a consumer subscription, a trial or a promotional credit makes every API request free.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Do I need Perplexity Pro to use the API?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"API access and a consumer Pro plan are separate products. Create API credentials and check API billing for the developer account you plan to use.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Should I use Agent API or Search API?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"Choose Agent when you want a finished grounded answer with sources. Choose Search when your application should own ranking, filtering and synthesis. You can combine Search with your own model if you need strict control over every generation step.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Can I call Perplexity from JavaScript?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"Yes. Use the server-side Node.js example above or the official JavaScript SDK. Keep the key on the server. When reading raw JSON, inspect the typed output items and apply the same source-ID mapping rules.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Are Perplexity citations guaranteed to be correct?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"No. A citation tells you which returned result the answer points to. Your application or reviewer must still check freshness, authority and whether the page supports the exact claim.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Why did my parser find no sources?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"Inspect the raw output item types, confirm that web search ran, and check whether your regular expression matches the preset's citation form. If no marker appears, save the answer as unverified and investigate the request rather than adding a guessed link.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Can GlobalGPT replace a Perplexity API key?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"GlobalGPT is an all-in-one AI workspace for everyday AI use. Its subscription and model access are separate from a Perplexity developer account, API key and API credits; this Python tutorial uses the developer account.\"\n            }\n        }\n    ]\n}<\/script>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>","protected":false},"excerpt":{"rendered":"<p>PERPLEXITY API \u00b7 Python \u6559\u7a0b \u00b7 2026 \u672c Perplexity API \u6559\u7a0b\u5c06\u5411\u60a8\u5c55\u793a\u5982\u4f55\u7f16\u5199\u4e00\u4e2a Python \u811a\u672c\uff0c\u8be5\u811a\u672c\u4f1a\u8fd4\u56de\u5305\u542b\u53ef\u70b9\u51fb\u7f51\u7edc\u6765\u6e90\u7684\u7b54\u6848\u3002 \u4f7f\u7528 Agent API \u53d1\u9001\u95ee\u9898\u3001\u8bfb\u53d6\u7b54\u6848\u3001\u5c06\u7b54\u6848\u4e2d\u7684\u5f15\u7528\u6807\u8bb0\u4e0e\u6765\u6e90 ID \u8fdb\u884c\u5339\u914d\uff0c\u5e76\u5bfc\u51fa\u4e00\u4e2a\u53ef\u4f9b\u60a8\u5ba1\u67e5\u7684 Markdown \u6587\u4ef6\u3002\u6211\u4eec\u5c06 [\u2026]<\/p>","protected":false},"author":17,"featured_media":20032,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"","_seopress_titles_title":"Perplexity API Tutorial: Build Answers with Sources","_seopress_titles_desc":"Perplexity API tutorial for Python: get a key, build answers with clickable sources, and match citation IDs correctly. Follow the complete script step by step.","_seopress_robots_index":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-20031","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-chat"],"acf":[],"_links":{"self":[{"href":"https:\/\/wp.glbgpt.com\/zh\/wp-json\/wp\/v2\/posts\/20031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.glbgpt.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.glbgpt.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.glbgpt.com\/zh\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.glbgpt.com\/zh\/wp-json\/wp\/v2\/comments?post=20031"}],"version-history":[{"count":2,"href":"https:\/\/wp.glbgpt.com\/zh\/wp-json\/wp\/v2\/posts\/20031\/revisions"}],"predecessor-version":[{"id":20038,"href":"https:\/\/wp.glbgpt.com\/zh\/wp-json\/wp\/v2\/posts\/20031\/revisions\/20038"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wp.glbgpt.com\/zh\/wp-json\/wp\/v2\/media\/20032"}],"wp:attachment":[{"href":"https:\/\/wp.glbgpt.com\/zh\/wp-json\/wp\/v2\/media?parent=20031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.glbgpt.com\/zh\/wp-json\/wp\/v2\/categories?post=20031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.glbgpt.com\/zh\/wp-json\/wp\/v2\/tags?post=20031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}