DeepSeek Search & Fetch in Claude Code and Codex
Connect the right provider, verify sources, and separate tool fees from model fees.
Use DeepSeek’s documented model-provider integration for native search: Claude Code connects through the Anthropic-compatible endpoint; Codex needs deepseek-v4-pro and live web search. If you need a predictable page-content response, the separate Fetch API returns Markdown. These paths send requests to DeepSeek. The examples below are source-checked configuration guidance, not a completed client or API test.
01 / HOW IT WORKS
From setup to a result you can check
01
Choose
Native client search or explicit HTTP input/output.
02
Prepare
Check account, client version and existing settings.
03
Connect
Set the provider without losing your previous configuration.
04
Verify
Inspect tool activity and read the cited page.
05
Budget
Count successful calls and stop unnecessary retries.
Suggested first-use sequence based on the official documentation. This is not a completed product test.
01 / PICK YOUR CONNECTION
Choose the path that matches the result you need
| Path | What changes | What to verify |
|---|---|---|
| Claude Code | DeepSeek API endpoint and model environment | A Web Search tool event and relevant source URLs |
| Codex local clients | DeepSeek provider/catalog, V4 Pro, live search | Effective provider/model, search activity and citations |
| Direct Search → Fetch | Your application sends JSON HTTP requests | Search results, then one selected page’s Markdown |
DeepSeek documents native Claude Code search and Codex web search. This is a provider change, not a search plugin that keeps an existing Claude/OpenAI model unchanged. For that different requirement, you would need a reviewed tool adapter; these docs do not supply a turnkey official MCP installation contract.
The Search and Fetch endpoints are raw JSON APIs. Do not paste either URL into an MCP server field. The billing note mentions server-side Fetch calls from clients, but it does not establish an identical Fetch button, tool trace or output schema in every client. Use the explicit HTTP path below when the Markdown contract matters.
02 / BEFORE YOU CONFIGURE
Prepare a reversible connection
Use an existing DeepSeek API account and a key from the official platform. Confirm that your organization permits sending the relevant queries, URLs and repository context to this provider. A paid ChatGPT or Claude subscription is not evidence that your DeepSeek API balance covers these calls.
Record the client version and current provider; save a private copy of the configuration you intend to edit. Use a disposable example project with no credentials or customer content. Keep your normal tool permissions and review prompts enabled. None of the steps requires disabling approvals.
For Claude Code, record claude --version; DeepSeek’s checked integration page does not state a minimum release for this feature. Its Codex catalog declares minimal_client_version: "0.144.0"; treat that as vendor metadata, not an independently tested compatibility matrix. Claude Code instructions · Codex catalog and configuration.
Use the installed client’s current supported configuration contract. If an app build does not expose the custom provider or rejects a field, stop and resolve that mismatch; do not assume a successful file edit proves the connection works.
03 / CLAUDE CODE
Point Claude Code at DeepSeek, then request a source
In a dedicated terminal, make your DeepSeek key available as DEEPSEEK_API_KEY through your normal secure environment mechanism. Do not put a real key into a shared snippet, repository or screenshot. This PowerShell example adapts the official environment mapping:
# Requires DEEPSEEK_API_KEY in this process; do not paste a key here.
if (-not $env:DEEPSEEK_API_KEY) { throw "Provide the DeepSeek key securely first." }
$env:ANTHROPIC_BASE_URL = "https://api.deepseek.com/anthropic"
$env:ANTHROPIC_AUTH_TOKEN = $env:DEEPSEEK_API_KEY
$env:ANTHROPIC_MODEL = "deepseek-flash[1m]"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "deepseek-flash[1m]"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "deepseek-flash[1m]"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "deepseek-flash"
$env:CLAUDE_CODE_SUBAGENT_MODEL = "deepseek-flash"
$env:CLAUDE_CODE_EFFORT_LEVEL = "max"
$env:CLAUDE_CODE_AUTO_COMPACT_WINDOW = "786432"
claudeRun from the intended example project. In Bash/zsh, use the same variable names with export NAME="value", and reference the existing key as "$DEEPSEEK_API_KEY" for the auth token. These terminal-scoped values do not configure a separately launched desktop process.
Ask the verification question below. DeepSeek says Claude Code invokes its search service when the model chooses Web Search; an answer alone does not prove it searched. Search summarization can add model-token charges. Closing this dedicated terminal removes its process-scoped overrides; persistent shell or application settings require restoring your own saved values. Native search and costs.
04 / CODEX
Configure the provider, then enable V4 Pro search
DeepSeek provides a configuration guide covering local CLI, desktop and IDE clients. This page uses the GUI after configuration; no CLI development workflow is required.
For the manual route, create the complete models.json from the official guide and merge its provider configuration into your existing ~/.codex/config.toml. The catalog is a prerequisite; the short fragment below is not a complete replacement file. Preserve unrelated MCP, trust and app settings. Do not create duplicate TOML sections.
Alternatively, inspect the vendor’s PowerShell setup script before using it. It backs up configuration, writes a model catalog and changes authentication/provider settings. Its key prompt uses ordinary Read-Host, and its generated provider contains a plaintext bearer token. Use a private terminal and protect both files and backups. We read this script; we did not run it.
After obtaining the complete catalog, merge the following manual configuration. Keep the initial fields top-level, before any TOML section header. The endpoint uses the Responses API; the environment-key choice follows OpenAI’s configuration reference below.
model = "deepseek-v4-pro"
model_provider = "deepseek"
model_catalog_json = "~/.codex/models.json"
preferred_auth_method = "apikey"
forced_login_method = "api"
model_reasoning_effort = "high"
web_search = "live"
[model_providers.deepseek]
name = "deepseek"
base_url = "https://api.deepseek.com/"
wire_api = "responses"
env_key = "DEEPSEEK_API_KEY"The vendor’s setup disables search initially. Its documented native search path supports V4 Pro only, even though the catalog also lists Flash. Restart the app and verify its effective provider/model before testing. DeepSeek Web Search instructions.
OpenAI’s configuration reference supports env_key and discourages direct experimental_bearer_token storage. The example uses that environment-key variation instead of copying a real token into TOML.
The app process must actually receive that environment variable; setting it in an unrelated terminal is insufficient. Do not leave both credential methods configured. We have not tested this variation against DeepSeek. To revert, close the app, restore your saved configuration and restart; retain any work created while using the provider.
05 / CHECK THE RESULT
Require a trace, a source and a bounded answer
Use this editorial test prompt only after accepting the account’s possible charges:
Search the official DeepSeek API documentation for Search and Fetch billing.
Report the charging start time and timezone, the billing unit, and when
an empty search result is charged. Cite the exact official URLs.
If a page cannot be read, say so. Do not change files or account settings.A useful acceptance record has four separate observations:
- The session’s provider and model match the configuration you intended.
- The client shows a search/tool event, rather than only a fluent answer.
- Opening the cited official URL supports the date, unit and empty-result rule. Record when you checked it.
- Account usage, when available, agrees with the calls you authorized. An answer containing citations is not a billing receipt.
If there is no search event, ask explicitly for a live source once and inspect the configuration. Do not loop prompts just to force a badge. If the client cannot expose whether Fetch ran, mark Fetch unverified and use the direct response below. Never publish an expected result as an observed run.
06 / EXPLICIT INPUT AND OUTPUT
Use direct Search → Fetch when you need the raw contract
These Bash examples are independent API calls, not commands that install tools into either client. They use an already-provided DEEPSEEK_API_KEY; check the billing section before running. Search accepts a query; inspect returned URLs before selecting one.
curl --fail-with-body --max-time 30 https://api.deepseek.com/v1/tools/search \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"Search Fetch billing site:api-docs.deepseek.com","count":3,"need_content":false}'Check HTTP status and the JSON results array. Items include title, url, snippet, summary and content. With need_content:false, empty content is expected. Query length is 1–128 Unicode characters, excluding whitespace-only queries; count is 1–50. Search schema.
For a known public documentation page:
curl --fail-with-body --max-time 30 https://api.deepseek.com/v1/tools/fetch \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://api-docs.deepseek.com/quick_start/pricing/"}'Fetch returns JSON containing title and Markdown content. The input must be an HTTP(S) URL with a host, at most 8,192 characters, without embedded username/password. Target-site access policy still applies. Fetch schema.
Save the response only in an approved location; remove tokens and private query data from logs. Treat retrieved text as source material, not instructions to reveal secrets or change local files. In an agent loop, allow only the intended public URLs and cap calls explicitly. A prompt request for “one search” is not a hard API budget enforcement mechanism.
07 / COST AND FREE-PERIOD BOUNDARIES
Budget successful tool calls and model tokens separately
As checked on 19 October 2026, the official pricing page lists US$0.75 per 1,000 successful Search requests and the same rate for Fetch. It says server-side tool calls through DeepSeek Harness, Claude Code and Codex are currently free, with request billing starting 1 November 2026, 00:00 Beijing time (UTC+8). That is 31 October, 16:00 UTC. This is not a claim that model inference or every raw API request is free until November.
A billable tool request needs HTTP200 and a nonempty result: Search needs results; Fetch needs page content. Failed calls, timeouts and empty search results are not billed. More returned search results do not increase the request price. Complete billing rules.
Our arithmetic example, after request billing applies: 100 successful searches + 100 successful fetches = 200 × $0.75 / 1,000 = $0.15 in tool fees, plus any model-token charges. This assumes exactly those calls; client summarization, repeated searches and other work are outside the example. Budget by observed calls, not by number of chats.
The official guide lists Search: 100 QPS per account and Fetch: 25 QPS per account, with independent limits; multiple keys do not multiply it. Fetch also has a domain limit whose numeric value is not stated in the checked guide. Rate-limit contract. Recheck official pricing before enabling ongoing use.
08 / RECOVERY
Fix the cause before repeating the request
| Symptom | Next action |
|---|---|
| Codex answers without searching | Check effective V4 Pro provider, top-level live-search setting and app restart; do not infer search from prose |
| Provider/catalog setting rejected | Compare the installed client contract and complete catalog; restore the backup if incompatible |
| HTTP400 or 401 | Correct JSON/field values or credential delivery before retrying; never print the token |
| HTTP402 | Check balance and authorized budget; do not automatically top up |
| Fetch403 or 404 | Check the URL and access policy; use another legitimate public source rather than bypassing restrictions |
| HTTP408, 429 or 5xx | Wait, then retry with a small explicit attempt cap; coordinate account traffic |
| HTTP200 with empty search results | Broaden the query once; do not report “source confirmed” |
The HTTP diagnoses follow DeepSeek’s documented errors. Our operational recommendation is to stop after a small bounded retry budget and preserve the last status, time and redacted request. A client-side timeout leaves the server outcome uncertain; a retry that also succeeds can be another billable request. Do not log it automatically as free.
Keep a final note with client build, provider/model, checked source URLs, observed tool events and cost visibility. Mark unavailable evidence as unknown. If you want DeepSeek’s separate agent application instead, see the Harness setup guide; its setup workflow is a different task.
06 / QUESTIONS
Before your first session
Can I keep my current Claude or OpenAI model and only replace its search?
The native paths here change the model provider. A separate adapter is a different integration and is not supplied by these JSON endpoints.
Is Codex Flash enough for the documented native search?
No. DeepSeek’s current Codex instructions require deepseek-v4-pro with live search.
Was this connection tested with a real API key?
No. We checked official contracts and this page’s rendering and copy controls. Client execution, returned search quality and account billing were not tested.
07 / SOURCES
Sources and what was not tested
Checked official documentation and the vendor’s PowerShell setup script on 19 October 2026. No client was reconfigured, setup script executed, API key entered, Search/Fetch request made or model call purchased. The acceptance prompt and cost arithmetic are our examples; they are not observed results. Compatibility may change with client builds and provider updates.
- Search and Fetch guide ↗
- Pricing ↗
- Claude Code integration ↗
- Codex integration ↗
- 17 October announcement ↗