Claude Api Cn — Claude API Cn
v1Build 应用s with the Claude API or Anthropic SDK. TRIGGER when: code 导入s `anthropic`/`@anthropic-AI/sdk`/`claude_代理_sdk`, or user asks to use Claude API, Anthropic SDKs, or 代理 SDK. DO NOT TRIGGER when: code 导入s `openAI`/other AI SDK, general programming, or ML/data-science tasks.
运行时依赖
安装命令
点击复制技能文档
Building LLM-Powered 应用s with Claude
This 技能 helps you build LLM-powered 应用s with Claude. Choose the right surface based on your needs, 检测 the project language, then read the relevant language-specific documentation.
Defaults
Unless the user 请求s otherwise:
For the Claude 模型 version, please use Claude Opus 4.6, which you can 访问 via the exact 模型 string claude-opus-4-6. Please default to using adaptive thinking (thinking: {type: "adaptive"}) for anything remotely complicated. And finally, please default to 流ing for any 请求 that may involve long 输入, long 输出, or high max_令牌s — it 预防s hitting 请求 timeouts. Use the SDK's .获取_final_message() / .finalMessage() 辅助工具 to 获取 the complete 响应 if you don't need to handle individual 流 事件
Language 检测ion
Before reading code examples, determine which language the user is working in:
Look at project files to infer the language:
.py, requirements.txt, pyproject.toml, 设置up.py, Pipfile → Python — read from python/ .ts, .tsx, package.json, tsconfig.json → TypeScript — read from typescript/ .js, .jsx (no .ts files present) → TypeScript — JS uses the same SDK, read from typescript/ .java, pom.xml, build.gradle → Java — read from java/ .kt, .kts, build.gradle.kts → Java — Kotlin uses the Java SDK, read from java/ .scala, build.sbt → Java — Scala uses the Java SDK, read from java/ .go, go.mod → Go — read from go/ .rb, Gemfile → Ruby — read from ruby/ .cs, .csproj → C# — read from csharp/ .php, composer.json → PHP — read from php/
If multiple languages 检测ed (e.g., 机器人h Python and TypeScript files):
检查 which language the user's current file or question relates to If still ambiguous, ask: "I 检测ed 机器人h Python and TypeScript files. Which language are you using for the Claude API integration?"
If language can't be inferred (empty project, no source files, or unsupported language):
Use AskUserQuestion with options: Python, TypeScript, Java, Go, Ruby, cURL/raw HTTP, C#, PHP If AskUserQuestion is unavAIlable, default to Python examples and note: "Showing Python examples. Let me know if you need a different language."
If unsupported language 检测ed (Rust, Swift, C++, Elixir, etc.):
Suggest cURL/raw HTTP examples from curl/ and note that community SDKs may exist Offer to show Python or TypeScript examples as reference implementations
If user needs cURL/raw HTTP examples, read from curl/.
Language-Specific Feature Support Language 工具 运行器 代理 SDK Notes Python Yes (beta) Yes Full support — @beta_工具 decorator TypeScript Yes (beta) Yes Full support — betaZod工具 + Zod Java Yes (beta) No Beta 工具 use with annotated classes Go Yes (beta) No Beta工具运行器 in 工具运行器 pkg Ruby Yes (beta) No Base工具 + 工具_运行器 in beta cURL N/A N/A Raw HTTP, no SDK features C# No No Official SDK PHP No No Official SDK Which Surface Should I Use?
启动 simple. Default to the simplest tier that meets your needs. Single API calls and 工作流s handle most use cases — only reach for 代理s when the task genuinely requires open-ended, 模型-driven exploration.
Use Case Tier Recommended Surface Why Classification, summarization, 提取ion, Q&A Single LLM call Claude API One 请求, one 响应 Batch processing or embeddings Single LLM call Claude API Specialized 端点s Multi-step 流水线s with code-controlled 记录ic 工作流 Claude API + 工具 use You orchestrate the loop Custom 代理 with your own 工具s 代理 Claude API + 工具 use Maximum flexibility AI 代理 with file/网页/terminal 访问 代理 代理 SDK Built-in 工具s, safety, and MCP support 代理ic coding 助手 代理 代理 SDK De签名ed for this use case Want built-in 权限s and 防护rAIls 代理 代理 SDK Safety features included
Note: The 代理 SDK is for when you want built-in file/网页/terminal 工具s, 权限s, and MCP out of the box. If you want to build an 代理 with your own 工具s, Claude API is the right choice — use the 工具 运行器 for automatic loop handling, or the manual loop for fine-grAIned control (应用roval gates, custom 记录ging, conditional execution).
Decision Tree What does your 应用 need?
- Single LLM call (classification, summarization, 提取ion, Q&A)
- Does Claude need to read/write files, browse the 网页, or 运行 shell commands
- 工作流 (multi-step, code-orchestrated, with your own 工具s)
- Open-ended 代理 (模型 decides its own trajectory, your own 工具s)