{"id":19043,"date":"2026-09-09T06:56:03","date_gmt":"2026-09-09T10:56:03","guid":{"rendered":"https:\/\/wp.glbgpt.com\/?p=19043"},"modified":"2026-09-09T06:56:05","modified_gmt":"2026-09-09T10:56:05","slug":"claude-api-guide","status":"publish","type":"post","link":"https:\/\/wp.glbgpt.com\/jp\/hub\/claude-api-guide","title":{"rendered":"Claude API \u30ac\u30a4\u30c9\uff1a\u6599\u91d1\u3001\u8a2d\u5b9a\u3001\u304a\u3088\u3073\u6700\u521d\u306e\u30ea\u30af\u30a8\u30b9\u30c8"},"content":{"rendered":"<p class=\"claude-api-deck wp-block-paragraph\">To make your first Claude API request, create a Claude Console key, keep it in an environment variable, call the Messages endpoint, read the returned <code>\u4f7f\u7528\u6cd5<\/code> fields, and calculate the token cost. This guide walks through that path with current model IDs and prices verified on September 8, 2026.<\/p>\n\n\n\n<aside class=\"cap-answer\" aria-label=\"Claude API quick path\" style=\"box-sizing:border-box;margin:28px 0;padding:20px 22px;border:1px solid #bed0c9;border-left:5px solid #0f766e;border-radius:6px;background:#f0f8f5;color:#183b34\">\n<!-- MODULE:direct-answer:START -->\n<style>\n.cap-answer{box-sizing:border-box;margin:28px 0;padding:20px 22px;border:1px solid #bed0c9;border-left:5px solid #0f766e;border-radius:6px;background:#f0f8f5;color:#183b34;font:16px\/1.6 system-ui,-apple-system,BlinkMacSystemFont,\"Segoe UI\",sans-serif;letter-spacing:0}.cap-answer strong{display:block;margin-bottom:8px;color:#15352f;font-size:18px}.cap-answer ol{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;margin:0;padding:0;list-style:none;counter-reset:steps}.cap-answer li{min-width:0;padding:10px;border:1px solid #cbdad5;border-radius:4px;background:#fff;color:#2e443e;font-size:13px}.cap-answer li:before{counter-increment:steps;content:counter(steps);display:grid;place-items:center;width:24px;height:24px;margin-bottom:7px;border-radius:50%;background:#203a34;color:#fff;font-weight:800}@media(max-width:760px){.cap-answer{padding:17px 15px}.cap-answer ol{grid-template-columns:1fr}.cap-answer li{display:grid;grid-template-columns:30px 1fr;align-items:center}.cap-answer li:before{margin:0}}\n<\/style>\n  <strong>Your first-request path<\/strong>\n  <ol><li>Create a Console key<\/li><li>Store it safely<\/li><li>Call Messages API<\/li><li>Read token usage<\/li><li>Estimate the cost<\/li><\/ol>\n<!-- MODULE:direct-answer:END -->\n<\/aside>\n\n\n\n<p class=\"globalgpt-intro wp-block-paragraph\">Once you understand the API path, the next question is how much of your day-to-day work actually needs custom integration. For research, writing, coding, and creative production, <a href=\"https:\/\/www.glbgpt.com\/home?inviter=hub_content_home&amp;login=1\">\u30b0\u30ed\u30fc\u30d0\u30ebGPT<\/a> offers a more economical way to use Claude alongside GPT-5.6 Sol, Gemini 3 Pro, Kimi K3, and other leading models. One subscription brings the models and a broad set of AI tools into one dashboard, so the work can move from idea to output without being split across separate services. When you do need to bring AI into your development setup, the GlobalGPT CLI connects that same workspace to your terminal and existing production tools.<\/p>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.glbgpt.com\/home\/claude-opus-5?inviter=hub_claude5&amp;login=1\"><img alt=\"\" fetchpriority=\"high\" decoding=\"async\" width=\"973\" height=\"619\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/07\/claude-opus-5-1.webp\" class=\"wp-image-17213\" srcset=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/07\/claude-opus-5-1.webp 973w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/07\/claude-opus-5-1-300x191.webp 300w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/07\/claude-opus-5-1-768x489.webp 768w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/07\/claude-opus-5-1-18x12.webp 18w\" sizes=\"(max-width: 973px) 100vw, 973px\" \/><\/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-luminous-vivid-amber-background-color has-text-color has-background has-link-color wp-element-button\" href=\"https:\/\/www.glbgpt.com\/home\/claude-opus-5?inviter=hub_claude5&amp;login=1\">Claude Opus 5 \u3092\u8a66\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n<nav class=\"cap-toc\" aria-label=\"\u76ee\u6b21\" style=\"box-sizing:border-box;margin:30px 0;padding:21px 23px;border-top:5px solid #d5533f;border-radius:6px;background:#202d29;color:#f5f8f6\">\n<!-- MODULE:toc:START -->\n<style>\n.cap-toc{box-sizing:border-box;margin:30px 0;padding:21px 23px;border-top:5px solid #d5533f;border-radius:6px;background:#202d29;color:#f5f8f6;font:15px\/1.5 system-ui,-apple-system,BlinkMacSystemFont,\"Segoe UI\",sans-serif;letter-spacing:0}.cap-toc strong{display:block;margin-bottom:12px;font-size:18px}.cap-toc ol{columns:2;column-gap:34px;margin:0;padding-left:21px}.cap-toc li{break-inside:avoid;margin:0 0 8px;padding-left:3px}.cap-toc a{color:#b9eee4;text-decoration-thickness:1px;text-underline-offset:3px}.cap-toc a:hover,.cap-toc a:focus{color:#fff}@media(max-width:660px){.cap-toc{padding:18px 16px}.cap-toc ol{columns:1}}\n<\/style>\n  <strong>\u3053\u306e\u30ac\u30a4\u30c9\u3067\u306f<\/strong>\n  <ol>\n    <li><a href=\"#what-is-claude-api\">What Is the Claude API?<\/a><\/li>\n    <li><a href=\"#claude-api-pricing-model-ids\">Claude API Pricing and Current Model IDs<\/a><\/li>\n    <li><a href=\"#claude-api-prerequisites\">What You Need Before Your First Request<\/a><\/li>\n    <li><a href=\"#claude-api-curl\">Send Your First Claude API Request with cURL<\/a><\/li>\n    <li><a href=\"#claude-api-python\">Send the Same Request with the Python SDK<\/a><\/li>\n    <li><a href=\"#claude-api-usage-cost\">How to Read Usage and Calculate Cost<\/a><\/li>\n    <li><a href=\"#claude-api-cost-calculator\">Claude API Pricing Calculator<\/a><\/li>\n    <li><a href=\"#claude-api-errors\">Common Claude API Errors and Fixes<\/a><\/li>\n    <li><a href=\"#claude-api-cost-controls\">How to Control Claude API Costs<\/a><\/li>\n    <li><a href=\"#claude-api-next-steps\">Next Steps After Your First Request<\/a><\/li>\n    <li><a href=\"#claude-api-faq\">\u3088\u304f\u3042\u308b\u8cea\u554f<\/a><\/li>\n  <\/ol>\n<!-- MODULE:toc:END -->\n<\/nav>\n\n\n\n<h2 id=\"what-is-claude-api\" class=\"wp-block-heading\">What Is the Claude API?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Claude API is Anthropic&#8217;s developer interface for sending structured requests to Claude models from an application, script, or backend service. You send messages to an HTTPS endpoint and receive a structured response containing generated content plus metadata such as the model, stop reason, and token usage.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Claude API vs. Claude.ai subscriptions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">API access and Claude.ai subscriptions solve different jobs. A Claude.ai plan gives a person access to Anthropic&#8217;s chat product. The API is metered developer access through Claude Console, with separate billing based on usage. Anthropic&#8217;s Help Center states that Claude Pro does not include Console API usage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you need the wider distinction between consumer plans, Claude Code, and token billing, see our complete <a href=\"https:\/\/www.glbgpt.com\/hub\/claude-ai-pricing-2026-the-ultimate-guide-to-plans-api-costs-and-limits\/\">Claude \u4fa1\u683c\u30ac\u30a4\u30c9<\/a>. For this tutorial, the important point is simple: create and fund the API account separately from any Claude.ai subscription.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The five-step path to a first request<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create an API key in Claude Console.<\/li>\n\n\n\n<li>Store it in the <code>ANTHROPIC_API_KEY<\/code> environment variable.<\/li>\n\n\n\n<li>Send a request to <code>https:\/\/api.anthropic.com\/v1\/messages<\/code>.<\/li>\n\n\n\n<li>Read the returned content and <code>\u4f7f\u7528\u6cd5<\/code> object.<\/li>\n\n\n\n<li>Multiply each token category by its applicable per-million-token rate.<\/li>\n<\/ol>\n\n\n\n<h2 id=\"claude-api-pricing-model-ids\" class=\"wp-block-heading\">Claude API Pricing and Current Model IDs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Anthropic lists API prices in US dollars per million tokens, often abbreviated as MTok. Input and output are billed separately. Prompt caching adds distinct rates for five-minute writes, one-hour writes, and cache reads, so a reliable estimate keeps those categories separate.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Current models and exact API IDs<\/h3>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th>\u30e2\u30c7\u30eb<\/th><th>API ID<\/th><th>\u5165\u529b \/ MTok<\/th><th>\u51fa\u529b \/ MTok<\/th><\/tr><\/thead><tbody><tr><td>Claude Fable 5.1<\/td><td><code>claude-fable-5-1<\/code><\/td><td>$10<\/td><td>$50<\/td><\/tr><tr><td>Claude Opus 5<\/td><td><code>claude-opus-5<\/code><\/td><td>$5<\/td><td>$25<\/td><\/tr><tr><td>\u30af\u30ed\u30fc\u30c9\u30fb\u30bd\u30cd\u30c3\u30c8\u7b2c5\u756a<\/td><td><code>claude-sonnet-5<\/code><\/td><td>$2<\/td><td>$10<\/td><\/tr><tr><td>\u30af\u30ed\u30fc\u30c9\u30fb\u30cf\u30a4\u30af 4.5<\/td><td><code>claude-haiku-4-5-20251001<\/code><\/td><td>$1<\/td><td>$5<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Base API rates verified against Anthropic&#8217;s official pricing and model documentation on September 8, 2026.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1400\" height=\"788\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-current-model-ids-2026-1.webp\" alt=\"Anthropic model table showing current Claude model names and API IDs\" class=\"wp-image-19078\" srcset=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-current-model-ids-2026-1.webp 1400w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-current-model-ids-2026-1-300x169.webp 300w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-current-model-ids-2026-1-1024x576.webp 1024w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-current-model-ids-2026-1-768x432.webp 768w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-current-model-ids-2026-1-18x10.webp 18w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><figcaption class=\"wp-element-caption\">Current Claude model IDs in Anthropic&#8217;s official documentation, verified September 8, 2026.<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Which model should you use for this tutorial?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The official Quickstart used <code>claude-opus-5<\/code> when this guide was verified, so the cURL and Python examples below use the same ID. Treat Opus as a starting point for the tutorial, then choose the production model by workload, quality needs, latency, and budget. Model IDs and lifecycle status can change, so recheck the Models and deprecations pages before shipping long-lived code.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1400\" height=\"788\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-official-pricing-2026-1.webp\" alt=\"Official Anthropic Claude API pricing table with token-category rates\" class=\"wp-image-19079\" srcset=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-official-pricing-2026-1.webp 1400w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-official-pricing-2026-1-300x169.webp 300w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-official-pricing-2026-1-1024x576.webp 1024w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-official-pricing-2026-1-768x432.webp 768w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-official-pricing-2026-1-18x10.webp 18w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><figcaption class=\"wp-element-caption\">Anthropic API prices are listed per million tokens and can change; rates shown were verified September 8, 2026.<\/figcaption><\/figure>\n\n\n\n<figure class=\"capv-figure\" data-verified-on=\"2026-09-08\" style=\"box-sizing:border-box;width:100%;margin:30px 0;padding:25px 27px 21px;border:1px solid #c9d1cd;border-top:6px solid #d5533f;border-radius:7px;background:#fff;color:#202723\">\n<!-- MODULE:price-comparison:START -->\n<style>\n.capv-figure{box-sizing:border-box;width:100%;margin:30px 0;padding:25px 27px 21px;border:1px solid #c9d1cd;border-top:6px solid #d5533f;border-radius:7px;background:#fff;color:#202723;font:14px\/1.45 system-ui,-apple-system,BlinkMacSystemFont,\"Segoe UI\",sans-serif;letter-spacing:0}.capv-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-end;margin-bottom:20px}.capv-title{margin:0 0 5px;font-size:25px;line-height:1.15;font-weight:800}.capv-head p{margin:0;color:#5d6862}.capv-key{display:flex;gap:14px;flex:0 0 auto;color:#46514c;font-size:12px;font-weight:700}.capv-key span:before{content:\"\";display:inline-block;width:11px;height:11px;margin-right:5px;border-radius:2px;vertical-align:-1px}.capv-key .input:before{background:#107469}.capv-key .output:before{background:#d5533f}.capv-rows{display:grid;gap:13px}.capv-row{display:grid;grid-template-columns:225px 1fr;gap:16px;align-items:center}.capv-name strong{display:block;font-size:15px}.capv-name code{color:#66716c;font-size:11px;overflow-wrap:anywhere}.capv-bars{display:grid;gap:6px}.capv-barline{display:grid;grid-template-columns:1fr 82px;align-items:center;gap:10px}.capv-track{height:18px;background:#edf0ee;border-radius:3px;overflow:hidden}.capv-bar{height:100%;min-width:3px;border-radius:3px}.capv-bar.input{background:#107469}.capv-bar.output{background:#d5533f}.capv-value{text-align:right;color:#2c3732;font-size:12px;font-variant-numeric:tabular-nums}.capv-foot{display:flex;justify-content:space-between;gap:18px;margin-top:20px;padding-top:12px;border-top:1px solid #e0e5e2;color:#5d6862;font-size:11px}.capv-foot a{color:#0a665d;font-weight:750}@media(max-width:680px){.capv-figure{padding:19px 15px 16px}.capv-head{display:block}.capv-title{font-size:21px}.capv-key{margin-top:10px}.capv-row{grid-template-columns:1fr;gap:5px}.capv-foot{display:block}.capv-foot span{display:block;margin-bottom:4px}}\n<\/style>\n  <header class=\"capv-head\"><div><div class=\"capv-title\" role=\"heading\" aria-level=\"3\">Claude API base token prices<\/div><p>USD per million tokens. Bar length is normalized to the $50 output maximum.<\/p><\/div><div class=\"capv-key\" aria-label=\"Legend\"><span class=\"input\">\u30a4\u30f3\u30d7\u30c3\u30c8<\/span><span class=\"output\">\u51fa\u529b<\/span><\/div><\/header>\n  <div class=\"capv-rows\">\n    <div class=\"capv-row\"><div class=\"capv-name\"><strong>Claude Fable 5.1<\/strong><code>claude-fable-5-1<\/code><\/div><div class=\"capv-bars\"><div class=\"capv-barline\"><div class=\"capv-track\"><div class=\"capv-bar input\" style=\"width:20%\"><\/div><\/div><span class=\"capv-value\">$10\u5165\u529b<\/span><\/div><div class=\"capv-barline\"><div class=\"capv-track\"><div class=\"capv-bar output\" style=\"width:100%\"><\/div><\/div><span class=\"capv-value\">$50\u306e\u51fa\u529b<\/span><\/div><\/div><\/div>\n    <div class=\"capv-row\"><div class=\"capv-name\"><strong>Claude Opus 5<\/strong><code>claude-opus-5<\/code><\/div><div class=\"capv-bars\"><div class=\"capv-barline\"><div class=\"capv-track\"><div class=\"capv-bar input\" style=\"width:10%\"><\/div><\/div><span class=\"capv-value\">$5\u5165\u529b<\/span><\/div><div class=\"capv-barline\"><div class=\"capv-track\"><div class=\"capv-bar output\" style=\"width:50%\"><\/div><\/div><span class=\"capv-value\">$25\u306e\u51fa\u529b<\/span><\/div><\/div><\/div>\n    <div class=\"capv-row\"><div class=\"capv-name\"><strong>\u30af\u30ed\u30fc\u30c9\u30fb\u30bd\u30cd\u30c3\u30c8\u7b2c5\u756a<\/strong><code>claude-sonnet-5<\/code><\/div><div class=\"capv-bars\"><div class=\"capv-barline\"><div class=\"capv-track\"><div class=\"capv-bar input\" style=\"width:4%\"><\/div><\/div><span class=\"capv-value\">$2 input<\/span><\/div><div class=\"capv-barline\"><div class=\"capv-track\"><div class=\"capv-bar output\" style=\"width:20%\"><\/div><\/div><span class=\"capv-value\">$10 output<\/span><\/div><\/div><\/div>\n    <div class=\"capv-row\"><div class=\"capv-name\"><strong>\u30af\u30ed\u30fc\u30c9\u30fb\u30cf\u30a4\u30af 4.5<\/strong><code>claude-haiku-4-5-20251001<\/code><\/div><div class=\"capv-bars\"><div class=\"capv-barline\"><div class=\"capv-track\"><div class=\"capv-bar input\" style=\"width:2%\"><\/div><\/div><span class=\"capv-value\">$1 input<\/span><\/div><div class=\"capv-barline\"><div class=\"capv-track\"><div class=\"capv-bar output\" style=\"width:10%\"><\/div><\/div><span class=\"capv-value\">$5\u306e\u51fa\u529b<\/span><\/div><\/div><\/div>\n  <\/div>\n  <figcaption class=\"capv-foot\"><span>Rates verified 2026-09-08. Cache, Batch, and US-only modifiers are not shown here.<\/span><a href=\"https:\/\/platform.claude.com\/docs\/en\/about-claude\/pricing\" target=\"_blank\" rel=\"noopener\">Official Anthropic pricing<\/a><\/figcaption>\n<!-- MODULE:price-comparison:END -->\n<\/figure>\n\n\n\n<h2 id=\"claude-api-prerequisites\" class=\"wp-block-heading\">What You Need Before Your First Request<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Create a Claude Console account and API key<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open Claude Console, create or select the appropriate organization, and create an API key. Anthropic warns that a new key is displayed only once, so store it in an approved secret manager or another secure location when it appears. Do not put the key into a screenshot, shared document, public repository, or browser-side JavaScript.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1400\" height=\"788\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-key-one-time-display-warning-1.webp\" alt=\"Anthropic documentation warning that a new Claude API key must be stored securely\" class=\"wp-image-19075\" srcset=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-key-one-time-display-warning-1.webp 1400w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-key-one-time-display-warning-1-300x169.webp 300w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-key-one-time-display-warning-1-1024x576.webp 1024w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-key-one-time-display-warning-1-768x432.webp 768w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-key-one-time-display-warning-1-18x10.webp 18w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><figcaption class=\"wp-element-caption\">Store the API key securely when it is created; never place it in browser-side code or a screenshot.<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Store the key in an environment variable<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The examples expect the variable <code>ANTHROPIC_API_KEY<\/code>. Enter the real value only in your private terminal or secret-management system. The command below reads the value without echoing it to the screen, then exports it for the current shell session:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>read -s ANTHROPIC_API_KEY\nexport ANTHROPIC_API_KEY<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Environment variables reduce accidental exposure, but they are not a complete secret-management strategy. Production applications should follow the hosting platform&#8217;s secret-storage and access-control practices.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Check billing and choose a safe test limit<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">API billing is separate from Claude.ai subscriptions. Anthropic says most organizations prepay usage credits, while organizations with monthly invoicing are an exception. Confirm that your Console account can make API requests, then keep the first request small with <code>max_tokens: 128<\/code>. That field limits generated output; it does not reserve or guarantee 128 billed output tokens.<\/p>\n\n\n\n<h2 id=\"claude-api-curl\" class=\"wp-block-heading\">Send Your First Claude API Request with cURL<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">cURL is useful for seeing the request contract directly. The example below uses the Messages endpoint, JSON content type, the API key header, Anthropic&#8217;s version header, the verified Quickstart model ID, and one user message.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before you run either example, add your own API key and confirm that API billing is enabled for the organization. The code follows Anthropic&#8217;s documented request format and passed local syntax checks, but no live account response is included here.<\/p>\n\n\n\n<section class=\"capcodebox\" aria-label=\"Copyable cURL example\" style=\"box-sizing:border-box;margin:28px 0;overflow:hidden;border:1px solid #bcc9c4;border-top:6px solid #d5533f;border-radius:7px;background:#fff;color:#202723\">\n<!-- MODULE:code-examples:START -->\n<style>\n.capcodebox{box-sizing:border-box;margin:28px 0;overflow:hidden;border:1px solid #bcc9c4;border-top:6px solid #d5533f;border-radius:7px;background:#fff;color:#202723;font:14px\/1.5 system-ui,-apple-system,BlinkMacSystemFont,\"Segoe UI\",sans-serif;letter-spacing:0}.capcodebox *{box-sizing:border-box}.capcodebox-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;padding:18px 20px 14px}.capcodebox-title{font-size:20px;font-weight:800}.capcodebox-badges{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px}.capcodebox-badge{padding:4px 7px;border:1px solid #a8c4bb;border-radius:4px;background:#edf7f4;color:#155a4f;font-size:11px;font-weight:800}.capcodebox-badge.warn{border-color:#dfbd87;background:#fff7e8;color:#70470a}.capcodebox-panel{position:relative;background:#18231f;color:#edf4f0}.capcodebox-toolbar{display:flex;justify-content:flex-end;padding:9px 12px;border-bottom:1px solid #34453f}.capcodebox-copy{min-height:34px;padding:6px 10px;border:1px solid #8ab3a7;border-radius:4px;background:#24423a;color:#fff;cursor:pointer;font-weight:750}.capcodebox-copy:focus-visible{outline:3px solid #e9ae5c;outline-offset:2px}.capcodebox pre{margin:0;padding:18px 20px;overflow-x:auto;color:#edf4f0;font:13px\/1.6 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;white-space:pre;tab-size:2}.capcodebox-note{margin:0;padding:11px 20px;background:#f7f9f8;color:#53615b;font-size:12px}@media(max-width:640px){.capcodebox-head{display:block;padding:15px}.capcodebox-badges{justify-content:flex-start;margin-top:9px}.capcodebox pre{padding:15px;font-size:11px}.capcodebox-note{padding:10px 15px}}\n<\/style>\n  <header class=\"capcodebox-head\"><div class=\"capcodebox-title\">First Claude API request with cURL<\/div><div class=\"capcodebox-badges\"><span class=\"capcodebox-badge\">\u30e1\u30c3\u30bb\u30fc\u30b8 API<\/span><span class=\"capcodebox-badge\">\u74b0\u5883\u5909\u6570<\/span><span class=\"capcodebox-badge warn\">Add your key to run<\/span><\/div><\/header>\n  <div class=\"capcodebox-panel\"><div class=\"capcodebox-toolbar\"><button class=\"capcodebox-copy\" type=\"button\" data-copy-target=\"cap-curl-code\">Copy cURL<\/button><\/div><pre id=\"cap-curl-code\"><code>curl https:\/\/api.anthropic.com\/v1\/messages \\\n  --header \"content-type: application\/json\" \\\n  --header \"x-api-key: $ANTHROPIC_API_KEY\" \\\n  --header \"anthropic-version: 2023-06-01\" \\\n  --data '{\n    \"model\": \"claude-opus-5\",\n    \"max_tokens\": 128,\n    \"messages\": [{\n      \"role\": \"user\",\n      \"content\": \"Reply with one sentence explaining what an API is.\"\n    }]\n  }'<\/code><\/pre><\/div>\n  <p class=\"capcodebox-note\">Add your Claude Console key through the environment variable, keep the version header in place, and run the command from a private terminal.<\/p>\n<script>\ndocument.querySelectorAll(\".capcodebox-copy\").forEach(function(button){button.addEventListener(\"click\",function(){var target=document.getElementById(button.getAttribute(\"data-copy-target\"));if(!target)return;navigator.clipboard.writeText(target.innerText).then(function(){var old=button.textContent;button.textContent=\"Copied\";setTimeout(function(){button.textContent=old},1400)}).catch(function(){button.textContent=\"Select code to copy\"})})});\n<\/script>\n<!-- MODULE:code-examples:END -->\n<\/section>\n\n\n\n<h3 class=\"wp-block-heading\">What each header and JSON field does<\/h3>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th>Part<\/th><th>\u76ee\u7684<\/th><\/tr><\/thead><tbody><tr><td><code>content-type<\/code><\/td><td>Tells the endpoint that the request body is JSON.<\/td><\/tr><tr><td><code>x-api-key<\/code><\/td><td>Authenticates the request with the value stored in the environment variable.<\/td><\/tr><tr><td><code>anthropic-version<\/code><\/td><td>Selects the documented API contract used by the request.<\/td><\/tr><tr><td><code>\u30e2\u30c7\u30eb<\/code><\/td><td>Chooses the exact Claude API model ID.<\/td><\/tr><tr><td><code>max_tokens<\/code><\/td><td>Sets the maximum number of tokens Claude may generate for this response.<\/td><\/tr><tr><td><code>\u30e1\u30c3\u30bb\u30fc\u30b8<\/code><\/td><td>Provides the ordered conversation input, including each role and content value.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If the command returns an error, read the HTTP status and error type before changing the request. Authentication and billing errors need an account fix, while malformed JSON or an invalid model ID needs a request change.<\/p>\n\n\n\n<h2 id=\"claude-api-python\" class=\"wp-block-heading\">Send the Same Request with the Python SDK<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Install the official Anthropic SDK<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>python -m pip install anthropic<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use a virtual environment when that is part of your normal Python workflow. The SDK reads <code>ANTHROPIC_API_KEY<\/code> from the environment when <code>anthropic.Anthropic()<\/code> is created without an explicit key.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Run the equivalent Python request<\/h3>\n\n\n\n<section class=\"cappython\" aria-label=\"Copyable Python SDK example\" style=\"box-sizing:border-box;margin:28px 0;overflow:hidden;border:1px solid #bcc9c4;border-top:6px solid #107469;border-radius:7px;background:#fff;color:#202723\">\n<!-- MODULE:python-example:START -->\n<style>\n.cappython{box-sizing:border-box;margin:28px 0;overflow:hidden;border:1px solid #bcc9c4;border-top:6px solid #107469;border-radius:7px;background:#fff;color:#202723;font:14px\/1.5 system-ui,-apple-system,BlinkMacSystemFont,\"Segoe UI\",sans-serif;letter-spacing:0}.cappython *{box-sizing:border-box}.cappython-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;padding:18px 20px 14px}.cappython-title{font-size:20px;font-weight:800}.cappython-badges{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px}.cappython-badge{padding:4px 7px;border:1px solid #a8c4bb;border-radius:4px;background:#edf7f4;color:#155a4f;font-size:11px;font-weight:800}.cappython-badge.warn{border-color:#dfbd87;background:#fff7e8;color:#70470a}.cappython-panel{background:#18231f;color:#edf4f0}.cappython-toolbar{display:flex;justify-content:flex-end;padding:9px 12px;border-bottom:1px solid #34453f}.cappython-copy{min-height:34px;padding:6px 10px;border:1px solid #8ab3a7;border-radius:4px;background:#24423a;color:#fff;cursor:pointer;font-weight:750}.cappython-copy:focus-visible{outline:3px solid #e9ae5c;outline-offset:2px}.cappython pre{margin:0;padding:18px 20px;overflow-x:auto;color:#edf4f0;font:13px\/1.6 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;white-space:pre;tab-size:2}.cappython-note{margin:0;padding:11px 20px;background:#f7f9f8;color:#53615b;font-size:12px}@media(max-width:640px){.cappython-head{display:block;padding:15px}.cappython-badges{justify-content:flex-start;margin-top:9px}.cappython pre{padding:15px;font-size:11px}.cappython-note{padding:10px 15px}}\n<\/style>\n  <header class=\"cappython-head\"><div class=\"cappython-title\">First Claude API request with Python<\/div><div class=\"cappython-badges\"><span class=\"cappython-badge\">Official SDK<\/span><span class=\"cappython-badge\">\u74b0\u5883\u5909\u6570<\/span><span class=\"cappython-badge warn\">Prints usage<\/span><\/div><\/header>\n  <div class=\"cappython-panel\"><div class=\"cappython-toolbar\"><button class=\"cappython-copy\" type=\"button\" data-copy-target=\"cap-python-code\">Copy Python<\/button><\/div><pre id=\"cap-python-code\"><code>import anthropic\n\nclient = anthropic.Anthropic()\n\nmessage = client.messages.create(\n    model=\"claude-opus-5\",\n    max_tokens=128,\n    messages=[\n        {\n            \"role\": \"user\",\n            \"content\": \"Reply with one sentence explaining what an API is.\",\n        }\n    ],\n)\n\nfor block in message.content:\n    if block.type == \"text\":\n        print(block.text)\n\nprint(message.usage)<\/code><\/pre><\/div>\n  <p class=\"cappython-note\">The SDK reads the same environment variable, returns typed content blocks, and exposes usage data for cost tracking.<\/p>\n<script>\ndocument.querySelectorAll(\".cappython-copy\").forEach(function(button){button.addEventListener(\"click\",function(){var target=document.getElementById(button.getAttribute(\"data-copy-target\"));if(!target)return;navigator.clipboard.writeText(target.innerText).then(function(){var old=button.textContent;button.textContent=\"Copied\";setTimeout(function(){button.textContent=old},1400)}).catch(function(){button.textContent=\"Select code to copy\"})})});\n<\/script>\n<!-- MODULE:python-example:END -->\n<\/section>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1400\" height=\"788\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-quickstart-python-example-1.webp\" alt=\"Official Anthropic Python SDK quickstart for sending a Claude API message\" class=\"wp-image-19077\" srcset=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-quickstart-python-example-1.webp 1400w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-quickstart-python-example-1-300x169.webp 300w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-quickstart-python-example-1-1024x576.webp 1024w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-quickstart-python-example-1-768x432.webp 768w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-quickstart-python-example-1-18x10.webp 18w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><figcaption class=\"wp-element-caption\">Anthropic&#8217;s Python quickstart sends a Messages API request through the official SDK.<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Read the returned text safely<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A Message response can contain more than one content block, so the example checks each block&#8217;s type before printing text. Real applications should also keep the request ID available for support and logging without exposing it publicly, record the returned model and stop reason, and handle API errors explicitly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Keep the content-block check even when you expect a short text answer. It makes the example easier to extend when a response contains multiple blocks, and printing <code>message.usage<\/code> gives you the numbers needed for the cost calculation below.<\/p>\n\n\n\n<h2 id=\"claude-api-usage-cost\" class=\"wp-block-heading\">How to Read Usage and Calculate Cost<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Find the response text, model, stop reason, and request ID<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Messages API response contract includes generated content, the model that handled the request, and a stop reason. The HTTP response also carries a request identifier that can help Anthropic support trace a problem. Log identifiers carefully; do not publish them with customer content or credentials.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Find input, output, and cache token usage<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u306b\u3064\u3044\u3066 <code>\u4f7f\u7528\u6cd5<\/code> object reports the token categories needed for cost analysis. At minimum, look for input and output tokens. When prompt caching is used, keep five-minute cache writes, one-hour cache writes, and cache reads separate because they have different rates. Anthropic&#8217;s Token Counting endpoint can estimate input tokens before a request, but the estimate can differ slightly from final input usage and has its own rate limits.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Convert token usage into an estimated cost<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Calculate each category independently, then add the results. For a planning example using Claude Opus 5 at standard global rates, 1,000 uncached input tokens cost <code>1,000 x $5 \/ 1,000,000 = $0.005<\/code>, while 300 output tokens cost <code>300 x $25 \/ 1,000,000 = $0.0075<\/code>. The estimated total is <code>$0.0125<\/code>. Replace these illustrative token counts with the <code>\u4f7f\u7528\u6cd5<\/code> values from your own response.<\/p>\n\n\n\n<aside class=\"capformula\" aria-label=\"Claude API cost formula\" style=\"box-sizing:border-box;margin:28px 0;padding:22px;border:1px solid #c7d1cd;border-radius:6px;background:#f8faf9;color:#21322d\">\n<!-- MODULE:cost-formula:START -->\n<style>\n.capformula{box-sizing:border-box;margin:28px 0;padding:22px;border:1px solid #c7d1cd;border-radius:6px;background:#f8faf9;color:#21322d;font:15px\/1.55 system-ui,-apple-system,BlinkMacSystemFont,\"Segoe UI\",sans-serif;letter-spacing:0}.capformula strong{display:block;margin-bottom:10px;font-size:19px}.capformula code{display:block;padding:14px;border-radius:4px;background:#23332e;color:#f5f8f6;font:13px\/1.6 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;white-space:normal;overflow-wrap:anywhere}.capformula p{margin:11px 0 0;color:#52615b;font-size:13px}\n<\/style>\n<strong>Category-by-category cost formula<\/strong><code>requests x tokens per request x effective category rate \/ 1,000,000<\/code><p>Apply the 50% Batch factor and eligible 1.1x US-only factor to each token category before adding the totals.<\/p>\n<!-- MODULE:cost-formula:END -->\n<\/aside>\n\n\n\n<h2 id=\"claude-api-cost-calculator\" class=\"wp-block-heading\">Claude API Pricing Calculator<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the calculator to vary the model, request count, token categories, billing mode, and inference geography. Batch processing prices eligible usage at 50% of standard rates. US-only inference applies a 1.1x factor to all token categories for eligible Claude 4.6+ models; Claude Haiku 4.5 is not eligible, so that combination returns an unsupported state.<\/p>\n\n\n\n<section class=\"capc-shell\" id=\"calculator\" data-calc-state=\"default\" style=\"box-sizing:border-box;width:100%;margin:28px 0;background:#fff;color:#1f2623;border:1px solid #cfd6d2;border-top:5px solid #d5533f;border-radius:7px;box-shadow:0 14px 34px rgba(24,34,29,.08);overflow:hidden\">\n<!-- MODULE:calculator:START -->\n<style>\n.capc-shell{box-sizing:border-box;width:100%;margin:28px 0;background:#fff;color:#1f2623;border:1px solid #cfd6d2;border-top:5px solid #d5533f;border-radius:7px;box-shadow:0 14px 34px rgba(24,34,29,.08);overflow:hidden;font:15px\/1.45 system-ui,-apple-system,BlinkMacSystemFont,\"Segoe UI\",sans-serif;letter-spacing:0}.capc-shell *{box-sizing:border-box}.capc-head{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;padding:20px 22px 14px;border-bottom:1px solid #e1e6e3}.capc-title{margin:0 0 4px;font-size:25px;line-height:1.15;font-weight:800}.capc-head p{margin:0;color:#58635e}.capc-date{flex:0 0 auto;padding:5px 8px;border:1px solid #b8c5bf;border-radius:4px;color:#34403a;font-size:12px;font-weight:700;white-space:nowrap}.capc-form{padding:16px 22px 18px}.capc-top-grid{display:grid;grid-template-columns:1.4fr 1fr 1fr;gap:12px;margin-bottom:12px}.capc-token-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-bottom:14px}.capc-field{min-width:0}.capc-field label,.capc-legend{display:block;margin:0 0 5px;color:#2c3732;font-size:12px;font-weight:750}.capc-field input,.capc-field select{width:100%;height:38px;padding:7px 9px;border:1px solid #aeb9b4;border-radius:4px;background:#fff;color:#1f2623;font:inherit}.capc-field input:focus,.capc-field select:focus,.capc-segment input:focus+label,.capc-button:focus-visible{outline:3px solid rgba(16,116,105,.28);outline-offset:2px;border-color:#107469}.capc-field [aria-invalid=\"true\"]{border-color:#b42318;background:#fff7f6}.capc-help{display:block;margin-top:3px;color:#68736d;font-size:11px}.capc-field-error{min-height:16px;margin:2px 0 0;color:#a61b12;font-size:11px}.capc-mode{margin:0;padding:0;border:0;min-width:0}.capc-segment{display:grid;grid-template-columns:1fr 1fr}.capc-segment input{position:absolute;opacity:0;pointer-events:none}.capc-segment label{display:grid;place-items:center;height:38px;margin:0;border:1px solid #aeb9b4;background:#fff;color:#35403b;cursor:pointer;font-weight:700}.capc-segment label:first-of-type{border-radius:4px 0 0 4px}.capc-segment label:last-of-type{border-left:0;border-radius:0 4px 4px 0}.capc-segment input:checked+label{background:#1f322d;color:#fff;border-color:#1f322d}.capc-actions{display:flex;gap:9px;margin-bottom:14px}.capc-button{min-height:38px;padding:8px 14px;border:1px solid #1f322d;border-radius:4px;background:#1f322d;color:#fff;cursor:pointer;font:inherit;font-weight:750}.capc-button.secondary{background:#fff;color:#29342f;border-color:#9da9a3}.capc-status{min-height:42px;display:flex;align-items:center;gap:9px;margin-bottom:12px;padding:9px 11px;border-left:4px solid #107469;background:#edf7f4;color:#21433b;font-weight:650}.capc-shell[data-calc-state=\"invalid\"] .capc-status,.capc-shell[data-calc-state=\"unsupported\"] .capc-status{border-left-color:#b42318;background:#fff0ee;color:#721c15}.capc-shell[data-calc-state=\"zero\"] .capc-status{border-left-color:#c17b19;background:#fff8e9;color:#63430f}.capc-results{display:grid;grid-template-columns:.72fr 1.28fr;gap:14px;align-items:stretch}.capc-totals{display:grid;grid-template-columns:1fr 1fr;gap:8px;align-content:start}.capc-total{padding:11px;border:1px solid #c7d0cc;border-radius:5px;background:#f8faf9}.capc-total strong{display:block;margin-top:2px;font-size:22px;color:#101713}.capc-total span{color:#59655f;font-size:11px;font-weight:700;text-transform:uppercase}.capc-meta{grid-column:1\/-1;margin:0;padding:9px 0 0;color:#58635e;font-size:12px}.capc-table-wrap{overflow-x:auto;border:1px solid #c7d0cc;border-radius:5px}.capc-table{width:100%;border-collapse:collapse;min-width:530px}.capc-table th,.capc-table td{padding:7px 9px;border-bottom:1px solid #e1e6e3;text-align:right;font-size:12px}.capc-table th:first-child,.capc-table td:first-child{text-align:left}.capc-table th{background:#263631;color:#fff}.capc-table tr:last-child td{border-bottom:0}.capc-foot{display:flex;justify-content:space-between;gap:20px;padding:11px 22px 13px;border-top:1px solid #e1e6e3;background:#f8faf9;color:#59655f;font-size:11px}.capc-foot p{margin:0}.capc-foot a{color:#0a665d;font-weight:750}@media(max-width:760px){.capc-head{display:block;padding:17px 16px 12px}.capc-title{font-size:22px}.capc-date{display:inline-block;margin-top:9px}.capc-form{padding:13px 16px 16px}.capc-top-grid,.capc-token-grid,.capc-results{grid-template-columns:1fr}.capc-token-grid{gap:7px}.capc-foot{display:block;padding:10px 16px}.capc-foot p+p{margin-top:5px}}@media(max-width:420px){.capc-actions{display:grid;grid-template-columns:1fr}.capc-total strong{font-size:19px}.capc-form{padding-left:12px;padding-right:12px}}\n<\/style>\n  <header class=\"capc-head\"><div><div class=\"capc-title\" role=\"heading\" aria-level=\"3\">Claude API Pricing Calculator<\/div><p>Base token estimate in USD. Account-specific charges are excluded.<\/p><\/div><div class=\"capc-date\">Rates verified 2026-09-08<\/div><\/header>\n  <form class=\"capc-form\" id=\"calc-form\" novalidate action=\"\">\n    <div class=\"capc-top-grid\">\n      <div class=\"capc-field\"><label for=\"model\">\u30e2\u30c7\u30eb<\/label><select id=\"model\" name=\"model\"><option value=\"claude-fable-5-1\">Claude Fable 5.1<\/option><option value=\"claude-opus-5\" selected>Claude Opus 5<\/option><option value=\"claude-sonnet-5\">\u30af\u30ed\u30fc\u30c9\u30fb\u30bd\u30cd\u30c3\u30c8\u7b2c5\u756a<\/option><option value=\"claude-haiku-4-5-20251001\">\u30af\u30ed\u30fc\u30c9\u30fb\u30cf\u30a4\u30af 4.5<\/option><\/select><\/div>\n      <fieldset class=\"capc-mode\"><legend class=\"capc-legend\">Billing mode<\/legend><div class=\"capc-segment\"><input type=\"radio\" id=\"mode-standard\" name=\"mode\" value=\"standard\" checked><label for=\"mode-standard\">\u30b9\u30bf\u30f3\u30c0\u30fc\u30c9<\/label><input type=\"radio\" id=\"mode-batch\" name=\"mode\" value=\"batch\"><label for=\"mode-batch\">\u30d0\u30c3\u30c1<\/label><\/div><\/fieldset>\n      <div class=\"capc-field\"><label for=\"geo\">Inference geography<\/label><select id=\"geo\" name=\"geo\"><option value=\"global\" selected>\u30b0\u30ed\u30fc\u30d0\u30eb<\/option><option value=\"us\">US-only<\/option><\/select><\/div>\n    <\/div>\n    <div class=\"capc-token-grid\">\n      <div class=\"capc-field\"><label for=\"requests\">Requests<\/label><input id=\"requests\" name=\"requests\" type=\"number\" value=\"1\" min=\"1\" max=\"1000000\" step=\"1\" inputmode=\"numeric\" aria-describedby=\"requests-help requests-error\"><small class=\"capc-help\" id=\"requests-help\">1 to 1,000,000<\/small><p class=\"capc-field-error\" id=\"requests-error\"><\/p><\/div>\n      <div class=\"capc-field\"><label for=\"inputTokens\">Uncached input \/ request<\/label><input id=\"inputTokens\" name=\"inputTokens\" type=\"number\" value=\"1000\" min=\"0\" max=\"100000000\" step=\"1\" inputmode=\"numeric\" aria-describedby=\"inputTokens-error\"><p class=\"capc-field-error\" id=\"inputTokens-error\"><\/p><\/div>\n      <div class=\"capc-field\"><label for=\"outputTokens\">Output \/ request<\/label><input id=\"outputTokens\" name=\"outputTokens\" type=\"number\" value=\"300\" min=\"0\" max=\"100000000\" step=\"1\" inputmode=\"numeric\" aria-describedby=\"outputTokens-error\"><p class=\"capc-field-error\" id=\"outputTokens-error\"><\/p><\/div>\n      <div class=\"capc-field\"><label for=\"cache5m\">5m cache write \/ request<\/label><input id=\"cache5m\" name=\"cache5m\" type=\"number\" value=\"0\" min=\"0\" max=\"100000000\" step=\"1\" inputmode=\"numeric\" aria-describedby=\"cache5m-error\"><p class=\"capc-field-error\" id=\"cache5m-error\"><\/p><\/div>\n      <div class=\"capc-field\"><label for=\"cache1h\">1h cache write \/ request<\/label><input id=\"cache1h\" name=\"cache1h\" type=\"number\" value=\"0\" min=\"0\" max=\"100000000\" step=\"1\" inputmode=\"numeric\" aria-describedby=\"cache1h-error\"><p class=\"capc-field-error\" id=\"cache1h-error\"><\/p><\/div>\n      <div class=\"capc-field\"><label for=\"cacheRead\">Cache read \/ request<\/label><input id=\"cacheRead\" name=\"cacheRead\" type=\"number\" value=\"0\" min=\"0\" max=\"100000000\" step=\"1\" inputmode=\"numeric\" aria-describedby=\"cacheRead-error\"><p class=\"capc-field-error\" id=\"cacheRead-error\"><\/p><\/div>\n    <\/div>\n    <div class=\"capc-actions\"><button class=\"capc-button\" type=\"submit\">Calculate<\/button><button class=\"capc-button secondary\" type=\"button\" id=\"reset-button\">Reset defaults<\/button><\/div>\n    <div class=\"capc-status\" id=\"status\" role=\"status\" aria-live=\"polite\">Default estimate: Claude Opus 5, Standard, Global.<\/div>\n    <section class=\"capc-results\" aria-label=\"Cost estimate\"><div class=\"capc-totals\"><div class=\"capc-total\"><span>\u3054\u8981\u671b\u306b\u3088\u308a<\/span><strong id=\"per-request\" data-raw-value=\"0.0125\">$0.012500<\/strong><\/div><div class=\"capc-total\"><span>Total workload<\/span><strong id=\"total-cost\" data-raw-value=\"0.0125\">$0.012500<\/strong><\/div><p class=\"capc-meta\" id=\"active-meta\">claude-opus-5 | Standard | Global<\/p><\/div><div class=\"capc-table-wrap\" style=\"overflow-x:auto;border:1px solid #c7d0cc;border-radius:5px\"><table class=\"capc-table\" style=\"width:100%;min-width:530px;border-collapse:collapse\"><thead><tr><th>\u30ab\u30c6\u30b4\u30ea\u30fc<\/th><th>Tokens\/request<\/th><th>Effective $\/MTok<\/th><th>\u5408\u8a08<\/th><\/tr><\/thead><tbody id=\"breakdown\"><\/tbody><\/table><\/div><\/section>\n  <input type=\"hidden\" name=\"trp-form-language\" value=\"jp\"\/><\/form>\n  <footer class=\"capc-foot\"><p>Estimate excludes taxes, negotiated rates, Fast Mode, server-tool fees, and currency conversion.<\/p><p><a href=\"https:\/\/platform.claude.com\/docs\/en\/about-claude\/pricing\" target=\"_blank\" rel=\"noopener\">Official Anthropic pricing<\/a><\/p><\/footer>\n  <noscript><div style=\"padding:16px 22px;border-top:1px solid #cfd6d2;background:#fff8e9;color:#4c350e\">JavaScript is off. For each category, multiply requests by tokens per request by the official rate, then divide by 1,000,000. Batch usage is charged at 50% of standard prices. US-only inference on eligible Claude 4.6+ models applies a 1.1x multiplier to every token category. Rates verified 2026-09-08.<\/div><\/noscript>\n<script>\n(function(){\"use strict\";var RATE_DATE=\"2026-09-08\",BATCH_FACTOR=.5,US_ONLY_FACTOR=1.1,MAX_REQUESTS=1000000,MAX_TOKENS=100000000;var RATES=Object.freeze({\"claude-fable-5-1\":{\"label\":\"Claude Fable 5.1\",\"input\":10,\"output\":50,\"cache5mWrite\":12.5,\"cache1hWrite\":20,\"cacheRead\":.25,\"usOnlyEligible\":true},\"claude-opus-5\":{\"label\":\"Claude Opus 5\",\"input\":5,\"output\":25,\"cache5mWrite\":6.25,\"cache1hWrite\":10,\"cacheRead\":.5,\"usOnlyEligible\":true},\"claude-sonnet-5\":{\"label\":\"Claude Sonnet 5\",\"input\":2,\"output\":10,\"cache5mWrite\":2.5,\"cache1hWrite\":4,\"cacheRead\":.2,\"usOnlyEligible\":true},\"claude-haiku-4-5-20251001\":{\"label\":\"Claude Haiku 4.5\",\"input\":1,\"output\":5,\"cache5mWrite\":1.25,\"cache1hWrite\":2,\"cacheRead\":.1,\"usOnlyEligible\":false}});var categories=[{field:\"inputTokens\",label:\"Uncached input\",rate:\"input\"},{field:\"outputTokens\",label:\"Output\",rate:\"output\"},{field:\"cache5m\",label:\"5m cache write\",rate:\"cache5mWrite\"},{field:\"cache1h\",label:\"1h cache write\",rate:\"cache1hWrite\"},{field:\"cacheRead\",label:\"Cache read\",rate:\"cacheRead\"}];var shell=document.getElementById(\"calculator\"),form=document.getElementById(\"calc-form\"),model=document.getElementById(\"model\"),geo=document.getElementById(\"geo\"),status=document.getElementById(\"status\"),breakdown=document.getElementById(\"breakdown\"),perRequest=document.getElementById(\"per-request\"),totalCost=document.getElementById(\"total-cost\"),activeMeta=document.getElementById(\"active-meta\"),resetButton=document.getElementById(\"reset-button\"),pristine=true;function money(value){if(value===0)return\"$0.000000\";if(value<.01)return\"$\"+value.toFixed(6);if(value<1)return\"$\"+value.toFixed(4);return\"$\"+value.toFixed(2)}function clearErrors(){[\"requests\"].concat(categories.map(function(item){return item.field})).forEach(function(id){var field=document.getElementById(id);field.removeAttribute(\"aria-invalid\");document.getElementById(id+\"-error\").textContent=\"\"})}function readInteger(id,min,max,blankIsZero){var field=document.getElementById(id),raw=field.value.trim(),value=raw===\"\"&#038;&#038;blankIsZero?0:Number(raw),message=\"\";if(raw===\"\"&#038;&#038;!blankIsZero)message=\"Enter a request count.\";else if(!Number.isFinite(value))message=\"Enter a finite number.\";else if(!Number.isInteger(value))message=\"Use a whole number.\";else if(value<min)message=\"Minimum: \"+min.toLocaleString()+\".\";else if(value>max)message=\"Maximum: \"+max.toLocaleString()+\".\";if(message){field.setAttribute(\"aria-invalid\",\"true\");document.getElementById(id+\"-error\").textContent=message;return{ok:false,value:0}}return{ok:true,value:value}}function setState(name,message){shell.dataset.calcState=name;status.textContent=message}function setTotals(per,total){perRequest.dataset.rawValue=String(per);totalCost.dataset.rawValue=String(total);perRequest.textContent=money(per);totalCost.textContent=money(total)}function render(){clearErrors();var requests=readInteger(\"requests\",1,MAX_REQUESTS,false),tokenValues={},valid=requests.ok;categories.forEach(function(item){var result=readInteger(item.field,0,MAX_TOKENS,true);tokenValues[item.field]=result.value;valid=valid&&result.ok});var selectedMode=form.elements.mode.value,selectedRate=RATES[model.value],batchFactor=selectedMode===\"batch\"?BATCH_FACTOR:1,geoFactor=geo.value===\"us\"?US_ONLY_FACTOR:1;activeMeta.textContent=model.value+\" | \"+(selectedMode===\"batch\"?\"Batch\":\"Standard\")+\" | \"+(geo.value===\"us\"?\"US-only\":\"Global\");if(!valid){setState(\"invalid\",\"Fix the highlighted value before calculating.\");setTotals(0,0);breakdown.innerHTML=\"\";return}if(geo.value===\"us\"&&!selectedRate.usOnlyEligible){setState(\"unsupported\",selectedRate.label+\" does not support US-only inference. Choose Global or a Claude 4.6+ model.\");setTotals(0,0);breakdown.innerHTML=\"\";return}var tokenTotal=categories.reduce(function(sum,item){return sum+tokenValues[item.field]},0);if(tokenTotal===0){setState(\"zero\",\"All token inputs are zero. Add at least one token category to estimate cost.\");setTotals(0,0);breakdown.innerHTML=\"\";return}var per=0,rows=categories.map(function(item){var tokens=tokenValues[item.field],effectiveRate=selectedRate[item.rate]*batchFactor*geoFactor,categoryPerRequest=tokens*effectiveRate\/1000000,categoryTotal=categoryPerRequest*requests.value;per+=categoryPerRequest;return\"<tr><td>\"+item.label+\"<\/td><td>\"+tokens.toLocaleString()+\"<\/td><td>$\"+effectiveRate.toFixed(3)+\"<\/td><td>\"+money(categoryTotal)+\"<\/td><\/tr>\"}),total=per*requests.value;breakdown.innerHTML=rows.join(\"\");setTotals(per,total);if(pristine)setState(\"default\",\"Default estimate: \"+selectedRate.label+\", Standard, Global. \"+money(total)+\" total.\");else setState(\"valid\",\"Estimate updated using \"+(selectedMode===\"batch\"?\"50% Batch pricing\":\"standard pricing\")+\" and \"+(geo.value===\"us\"?\"1.1x US-only\":\"global routing\")+\". \"+money(total)+\" total.\")}form.addEventListener(\"submit\",function(event){event.preventDefault();pristine=false;render()});form.addEventListener(\"input\",function(){pristine=false;render()});form.addEventListener(\"change\",function(){pristine=false;render()});resetButton.addEventListener(\"click\",function(){form.reset();pristine=true;render()});render();window.__CAPC_TEST__=Object.freeze({RATE_DATE:RATE_DATE,RATES:RATES,BATCH_FACTOR:BATCH_FACTOR,US_ONLY_FACTOR:US_ONLY_FACTOR})})();\n<\/script>\n<!-- MODULE:calculator:END -->\n<\/section>\n\n\n\n<p class=\"wp-block-paragraph\">The estimate is a planning aid, not an invoice. It excludes taxes, currency conversion, negotiated terms, Fast Mode, server-tool charges, and account-specific conditions. Prices and eligibility can change, so recheck the official pricing page before making a purchasing or architecture decision.<\/p>\n\n\n\n<p class=\"globalgpt-cost-bridge wp-block-paragraph\">The calculator above shows the cost shape of programmable, metered Claude API calls. For everyday work that spans several models and AI capabilities, <a href=\"https:\/\/www.glbgpt.com\/home?inviter=hub_content_home&amp;login=1\">\u30b0\u30ed\u30fc\u30d0\u30ebGPT<\/a> offers a different kind of value: one subscription brings multiple mainstream models and tools into one dashboard, making costs easier to anticipate while keeping research, writing, coding, and creative work out of separate subscriptions and scattered interfaces. Its CLI carries the same platform into terminal-based development and the production tools you already use. Our guide to <a href=\"https:\/\/www.glbgpt.com\/hub\/all-in-one-ai-models\/\">working with multiple AI models in one place<\/a> shows how the wider platform fits together.<\/p>\n\n\n\n<h2 id=\"claude-api-errors\" class=\"wp-block-heading\">Common Claude API Errors and Fixes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Start with the HTTP status and Anthropic error type, then inspect the request without exposing the key. The official meaning narrows the search; the likely cause still depends on your account, selected model, request shape, and traffic.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1400\" height=\"788\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-400-413-1.webp\" alt=\"Anthropic API documentation for 400 through 413 client errors\" class=\"wp-image-19080\" srcset=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-400-413-1.webp 1400w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-400-413-1-300x169.webp 300w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-400-413-1-1024x576.webp 1024w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-400-413-1-768x432.webp 768w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-400-413-1-18x10.webp 18w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><figcaption class=\"wp-element-caption\">Anthropic separates malformed requests, authentication, credit, permission, missing-resource, conflict, and request-size errors.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th>\u30b9\u30c6\u30fc\u30bf\u30b9<\/th><th>Official boundary<\/th><th>What to check next<\/th><th>Retry?<\/th><\/tr><\/thead><tbody><tr><td>400<\/td><td>Invalid request<\/td><td>Validate JSON, field names, roles, model ID, and parameter combinations.<\/td><td>Only after correcting the request.<\/td><\/tr><tr><td>401<\/td><td>Authentication error<\/td><td>Confirm the key exists, is active, and reaches the server through <code>x-api-key<\/code>. Never print it.<\/td><td>No blind retry; fix authentication first.<\/td><\/tr><tr><td>402<\/td><td>Billing or credit requirement<\/td><td>Check the organization&#8217;s API billing and available usage credits in Console.<\/td><td>After the billing condition is resolved.<\/td><\/tr><tr><td>403<\/td><td>Permission error<\/td><td>Check whether the key and organization can use the requested resource or model.<\/td><td>No blind retry; correct access first.<\/td><\/tr><tr><td>404<\/td><td>Resource not found<\/td><td>Check the endpoint, resource identifier, model lifecycle, and spelling.<\/td><td>Only after correcting the target.<\/td><\/tr><tr><td>413<\/td><td>Request too large<\/td><td>Reduce request size or split the input; do not merely increase <code>max_tokens<\/code>.<\/td><td>After reducing the request.<\/td><\/tr><tr><td>429<\/td><td>\u30ec\u30fc\u30c8\u5236\u9650\u8d85\u904e<\/td><td>Inspect rate-limit headers and your Console tier, reduce concurrency, and back off.<\/td><td>Yes, with controlled backoff.<\/td><\/tr><tr><td>500<\/td><td>Internal API error<\/td><td>Record the request ID, preserve idempotency, and check Anthropic status information.<\/td><td>Usually, with bounded backoff.<\/td><\/tr><tr><td>504<\/td><td>Gateway timeout<\/td><td>Check whether the request was unusually long and whether retrying could duplicate work.<\/td><td>Often, if the operation is safe to retry.<\/td><\/tr><tr><td>529<\/td><td>API temporarily overloaded<\/td><td>Reduce bursts and retry after backoff; do not treat overload as an authentication failure.<\/td><td>Yes, with bounded backoff.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1400\" height=\"788\" src=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-429-529-1.webp\" alt=\"Anthropic API documentation for 429 through 529 limit and server errors\" class=\"wp-image-19076\" srcset=\"https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-429-529-1.webp 1400w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-429-529-1-300x169.webp 300w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-429-529-1-1024x576.webp 1024w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-429-529-1-768x432.webp 768w, https:\/\/wp.glbgpt.com\/wp-content\/uploads\/2026\/09\/claude-api-common-errors-429-529-1-18x10.webp 18w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><figcaption class=\"wp-element-caption\">Rate limits, server failures, timeouts, and overloaded responses need different retry decisions.<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">A safe debugging order<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Record the status, error type, timestamp, and request ID without recording the API key.<\/li>\n\n\n\n<li>Check the endpoint, headers, JSON syntax, model ID, and request-size boundary.<\/li>\n\n\n\n<li>Check organization billing, permissions, rate-limit headers, and current model lifecycle.<\/li>\n\n\n\n<li>Retry only errors that can reasonably be temporary, using bounded exponential backoff and jitter.<\/li>\n\n\n\n<li>If the error persists, reduce the request to the smallest reproducible case before contacting support.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Anthropic&#8217;s official SDKs retry connection errors, 429 responses, and 5xx responses twice by default. Application-level retry logic still needs limits and idempotency awareness, especially when a request can trigger tools or another external action.<\/p>\n\n\n\n<h2 id=\"claude-api-cost-controls\" class=\"wp-block-heading\">How to Control Claude API Costs<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Set conservative output limits<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Start with the smallest <code>max_tokens<\/code> value that can still produce a useful answer. Measure actual output usage before increasing it. Shorter prompts can help, but removing instructions that prevent retries, errors, or unusable output can cost more overall.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Use prompt caching and Batch only when they fit<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use prompt caching when a substantial prompt prefix repeats and the cache lifetime matches the workflow.<\/li>\n\n\n\n<li>Use Batch for work that can complete asynchronously; eligible Batch usage is priced at 50% of standard rates.<\/li>\n\n\n\n<li>Keep cache writes and reads separate in reporting so the saving is visible rather than assumed.<\/li>\n\n\n\n<li>Use US-only inference only when the residency requirement justifies its 1.1x token-price factor and the selected model is eligible.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Monitor usage, rate limits, and spend limits<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Track request count, model ID, input and output usage, cache categories, retries, and errors. Set alerts or spend controls available to your organization, but do not assume that another account&#8217;s tier or limit applies to yours. Our deeper guide to <a href=\"https:\/\/www.glbgpt.com\/hub\/claude-ai-pricing-2026-the-ultimate-guide-to-plans-api-costs-and-limits\/\">Claude plans, API costs, and limits<\/a> covers the wider billing routes.<\/p>\n\n\n\n<h2 id=\"claude-api-next-steps\" class=\"wp-block-heading\">Next Steps After Your First Request<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Choose the right path for your next project<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For an application, continue with Anthropic&#8217;s official Messages API reference, streaming guidance, tool-use documentation, model lifecycle pages, and your own logging and evaluation plan. Pin a model strategy deliberately, handle errors before adding traffic, and calculate costs from observed usage rather than prompt length alone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If coding is your main use case, our guide to <a href=\"https:\/\/www.glbgpt.com\/hub\/how-to-use-claude-ai-for-coding\/\">\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306b\u30af\u30ed\u30fc\u30c9AI\u3092\u4f7f\u7528<\/a> covers practical ways to move from an interactive coding task to a repeatable developer workflow.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">When a multi-model workspace is the better tool<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Direct API access is the right route when you need code-level integration, developer billing, request metadata, or official platform controls. If your goal is interactive writing, research, planning, or comparing outputs across providers without building an application, a multi-model workspace may be more practical.<\/p>\n\n\n\n<aside class=\"capdecision\" aria-label=\"Choose between direct API access and the GlobalGPT workflow\" style=\"box-sizing:border-box;margin:28px 0;padding:22px;border:1px solid #c9d2ce;border-radius:6px;background:#fff;color:#23332e\">\n<!-- MODULE:decision-boundary:START -->\n<style>\n.capdecision{box-sizing:border-box;margin:28px 0;padding:22px;border:1px solid #c9d2ce;border-radius:6px;background:#fff;color:#23332e;font:15px\/1.55 system-ui,-apple-system,BlinkMacSystemFont,\"Segoe UI\",sans-serif;letter-spacing:0}.capdecision-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.capdecision-item{padding:16px;border-radius:5px;background:#f4f7f5}.capdecision-item strong{display:block;margin-bottom:6px;font-size:17px}.capdecision a{display:inline-flex;margin-top:11px;padding:9px 13px;border-radius:4px;background:#1f3a33;color:#fff;text-decoration:none;font-weight:800}.capdecision small{display:block;margin-top:10px;color:#59665f}@media(max-width:640px){.capdecision{padding:16px}.capdecision-grid{grid-template-columns:1fr}}\n<\/style>\n<div class=\"capdecision-grid\"><div class=\"capdecision-item\"><strong>Build with the Claude API<\/strong>Turn a proven prompt into a product feature, automate a backend workflow, inspect usage, and control requests in code.<\/div><div class=\"capdecision-item\"><strong>Bring GlobalGPT into your workflow<\/strong>Use one subscription for Claude and other leading models across a broad AI toolkit, then connect the CLI to terminal-based development and existing production tools.<br><a href=\"https:\/\/www.glbgpt.com\/home?inviter=hub_content_home&amp;login=1\">Use GlobalGPT in your workflow<\/a><\/div><\/div><small>Use metered API calls for programmable automation, or bring GlobalGPT&#8217;s multi-model toolkit into ongoing research, writing, coding, and production work.<\/small>\n<!-- MODULE:decision-boundary:END -->\n<\/aside>\n\n\n\n<h2 id=\"claude-api-faq\" class=\"wp-block-heading\">\u3088\u304f\u3042\u308b\u8cea\u554f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Is the Claude API free?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No universal free API allowance is promised here. Claude API usage is billed separately through Claude Console, and Anthropic says most organizations fund usage with prepaid credits, while monthly-invoiced organizations are an exception. Check the current Console and official pricing information for your organization before sending requests.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I get a Claude API key?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create a key in Claude Console for the appropriate organization. Anthropic warns that the new key is displayed only once, so store it securely when it appears. Load it through a server-side environment variable or secret manager, and never expose it in browser code, screenshots, or a public repository.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Which Claude model ID should I use?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This tutorial uses <code>claude-opus-5<\/code> because that was the model in Anthropic&#8217;s official Quickstart when verified on September 8, 2026. Choose the model that fits your workload and budget, and recheck Anthropic&#8217;s Models and deprecations pages because model IDs, aliases, and lifecycle status can change.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What endpoint does the Claude API use?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The first request in this guide uses the Messages endpoint at https:\/\/api.anthropic.com\/v1\/messages. It sends JSON with content-type, x-api-key, and anthropic-version headers. Anthropic provides other API capabilities too, so use the reference page for the operation you are implementing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Does Claude Pro include API credits?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. Anthropic&#8217;s Help Center states that Claude Pro does not include usage through Claude Console. A Claude.ai subscription and API billing are separate products. Set up API billing in Console for developer requests, and use our <a href=\"https:\/\/www.glbgpt.com\/hub\/claude-ai-pricing-2026-the-ultimate-guide-to-plans-api-costs-and-limits\/\">Claude \u4fa1\u683c\u30ac\u30a4\u30c9<\/a> for the wider plan comparison.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How much does one Claude API request cost?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Cost depends on the selected model, input tokens, output tokens, cache writes, cache reads, Batch mode, and eligible inference geography. Calculate each category as requests multiplied by tokens multiplied by its effective per-million-token rate, divided by one million, then add the categories. Use the calculator above for an estimate.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why am I getting a 401 error?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A 401 is an authentication error. Confirm that the API key exists, remains active, belongs to the intended organization, and reaches the server in the <code>x-api-key<\/code> header. Do not print or share the key while debugging. Repeated retries will not repair a missing or invalid credential.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why am I getting a 429 error?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A 429 means the request exceeded a rate limit. Limits can vary by organization and usage tier, so inspect the returned rate-limit headers and current Console or documentation. Reduce concurrency, respect retry timing, and use bounded exponential backoff with jitter instead of immediately repeating the same burst.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"claude-api-source-note wp-block-paragraph\"><strong>Source and freshness note:<\/strong> Model IDs, prices, API behavior, and support policies were checked against Anthropic&#8217;s official documentation on September 8, 2026. Review the current model and pricing pages before production use, then run the examples with your own Claude Console key, billing setup, and account access.<\/p>\n\n\n\n<!-- MODULE:faq-schema:START -->\n<script type=\"application\/ld+json\">{\n    \"@context\": \"https:\\\/\\\/schema.org\",\n    \"@type\": \"FAQPage\",\n    \"mainEntity\": [\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Is the Claude API free?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"No universal free API allowance is promised here. Claude API usage is billed separately through Claude Console, and Anthropic says most organizations fund usage with prepaid credits, while monthly-invoiced organizations are an exception. Check the current Console and official pricing information for your organization before sending requests.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"How do I get a Claude API key?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"Create a key in Claude Console for the appropriate organization. Anthropic warns that the new key is displayed only once, so store it securely when it appears. Load it through a server-side environment variable or secret manager, and never expose it in browser code, screenshots, or a public repository.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Which Claude model ID should I use?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"This tutorial uses claude-opus-5 because that was the model in Anthropic's official Quickstart when verified on September 8, 2026. Choose the model that fits your workload and budget, and recheck Anthropic's Models and deprecations pages because model IDs, aliases, and lifecycle status can change.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"What endpoint does the Claude API use?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"The first request in this guide uses the Messages endpoint at https:\\\/\\\/api.anthropic.com\\\/v1\\\/messages. It sends JSON with content-type, x-api-key, and anthropic-version headers. Anthropic provides other API capabilities too, so use the reference page for the operation you are implementing.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Does Claude Pro include API credits?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"No. Anthropic's Help Center states that Claude Pro does not include usage through Claude Console. A Claude.ai subscription and API billing are separate products. Set up API billing in Console for developer requests, and use our Claude pricing guide for the wider plan comparison.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"How much does one Claude API request cost?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"Cost depends on the selected model, input tokens, output tokens, cache writes, cache reads, Batch mode, and eligible inference geography. Calculate each category as requests multiplied by tokens multiplied by its effective per-million-token rate, divided by one million, then add the categories. Use the calculator above for an estimate.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Why am I getting a 401 error?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"A 401 is an authentication error. Confirm that the API key exists, remains active, belongs to the intended organization, and reaches the server in the x-api-key header. Do not print or share the key while debugging. Repeated retries will not repair a missing or invalid credential.\"\n            }\n        },\n        {\n            \"@type\": \"Question\",\n            \"name\": \"Why am I getting a 429 error?\",\n            \"acceptedAnswer\": {\n                \"@type\": \"Answer\",\n                \"text\": \"A 429 means the request exceeded a rate limit. Limits can vary by organization and usage tier, so inspect the returned rate-limit headers and current Console or documentation. Reduce concurrency, respect retry timing, and use bounded exponential backoff with jitter instead of immediately repeating the same burst.\"\n            }\n        }\n    ]\n}<\/script>\n<!-- MODULE:faq-schema:END -->","protected":false},"excerpt":{"rendered":"<p>To make your first Claude API request, create a Claude Console key, keep it in an environment variable, call the Messages endpoint, read the returned usage fields, and calculate the token cost. This guide walks through that path with current model IDs and prices verified on September 8, 2026. Your first-request path Create a Console key Store it safely Call Messages API Read token usage Estimate the cost Once you understand the API path, the next question is how much of your day-to-day work actually needs custom integration. For research, writing, coding, and creative production, GlobalGPT offers a more economical way to use Claude alongside GPT-5.6 Sol, Gemini 3 Pro, [&hellip;]<\/p>","protected":false},"author":7,"featured_media":19073,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"Claude API Guide: Pricing, Setup & First Request","_seopress_titles_desc":"Learn Claude API pricing, create a secure API key, send your first cURL and Python requests, estimate token costs, and fix common errors.","_seopress_robots_index":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-19043","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-chat"],"_links":{"self":[{"href":"https:\/\/wp.glbgpt.com\/jp\/wp-json\/wp\/v2\/posts\/19043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.glbgpt.com\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.glbgpt.com\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.glbgpt.com\/jp\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.glbgpt.com\/jp\/wp-json\/wp\/v2\/comments?post=19043"}],"version-history":[{"count":3,"href":"https:\/\/wp.glbgpt.com\/jp\/wp-json\/wp\/v2\/posts\/19043\/revisions"}],"predecessor-version":[{"id":19081,"href":"https:\/\/wp.glbgpt.com\/jp\/wp-json\/wp\/v2\/posts\/19043\/revisions\/19081"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wp.glbgpt.com\/jp\/wp-json\/wp\/v2\/media\/19073"}],"wp:attachment":[{"href":"https:\/\/wp.glbgpt.com\/jp\/wp-json\/wp\/v2\/media?parent=19043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.glbgpt.com\/jp\/wp-json\/wp\/v2\/categories?post=19043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.glbgpt.com\/jp\/wp-json\/wp\/v2\/tags?post=19043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}