DeepSeek API: build a quote-to-JSON request

Independent setup guidance. Guides and local tools are free; provider inference has its own terms. The site-provided pool is separate.

The direct DeepSeek model API is metered. Free access to a chat app does not grant free API inference. This guide builds a request for your own provider account; it does not promise a free DeepSeek key from ChinaGenAI.

Define the task before the request

Turn one supplier quote into explicit fields. Success means the output preserves quantity, currency, unit price and MOQ, uses null for missing information, and does not invent freight or delivery terms.

Example only: Cedar offers 250 units at USD 5.20 each, MOQ 200, EXW Ningbo. Payment: 30% deposit, 70% before dispatch. Lead time is not stated.

This is a constructed example, not a real supplier quote. No named model has been benchmarked against it on this site.

Get the provider’s key and model ID

  1. Open the DeepSeek API platform and inspect your API balance and current pricing.
  2. Create a key in your account. Use it only in your local environment or server-side secret store.
  3. Check the current model ID. The setup and pricing pages checked on 19 October 2026 list deepseek-flash; confirm your account’s current access before running the example.
DeepSeek model pricing

For app-specific connection fields and provider settings, see DeepSeek API setup details.

Build a small, bounded request

The sample requests at most 256 output tokens. Replace YOUR_PROVIDER_KEY locally. This request may incur provider charges and has not been presented as a successful live call.

cURL request
curl 'https://api.deepseek.com/chat/completions' \
  -H 'Authorization: Bearer YOUR_PROVIDER_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "deepseek-flash",
  "messages": [
    {
      "role": "user",
      "content": "Extract the supplier quote into JSON with these fields: supplier, quantity, currency, unit_price, moq, incoterm, port, payment, lead_time_days. Use null for missing facts. Preserve currencies and units. Do not infer shipping costs or promise delivery. Return JSON only.\n\nExample only: Cedar offers 250 units at USD 5.20 each, MOQ 200, EXW Ningbo. Payment: 30% deposit, 70% before dispatch. Lead time is not stated."
    }
  ],
  "max_tokens": 256,
  "stream": false,
  "reasoning_effort": "none"
}'

Prefer the interactive request builder if your model ID or base URL differs. API compatibility describes request shape, not identical features across providers.

Validate fields, then verify meaning

Read the assistant content from the provider’s JSON response and paste the inner JSON object into the quote JSON checker. This handwritten example illustrates the expected shape:

Handwritten JSON example
{
  "supplier": "Cedar",
  "quantity": 250,
  "currency": "USD",
  "unit_price": 5.2,
  "moq": 200,
  "incoterm": "EXW",
  "port": "Ningbo",
  "payment": "30% deposit, 70% before dispatch",
  "lead_time_days": null
}

A passing field check cannot prove the model extracted the right facts. Compare each number, currency and unit with the source. Keep missing lead time as null. Do not treat EXW as an all-in delivered price.

Connect the task to n8n

Use n8n’s documented DeepSeek chat-model node for a supported direct-provider setup. For a custom compatible gateway, check that the selected node accepts its base URL; otherwise configure an HTTP Request node with server-side credentials. Validate returned data before sending it to a spreadsheet or another action.

n8n DeepSeek node documentation

For a custom endpoint, follow the HTTP workflow connection guide. Start with one fictional quote. Confirm the fields and error path before enabling batch work. We have not run or certified a downloadable n8n workflow here.

If a request fails

  • Authentication failure: verify the credential belongs to the selected provider and has not expired or been revoked.
  • Model access failure: compare the exact model ID with the key’s permitted models. A listing on a website does not prove permission.
  • Quota, rate-limit or upstream failure: check the provider account. Do not retry indefinitely or silently switch to a paid model.

These are diagnostic categories, not a fabricated log of DeepSeek errors. Provider-specific codes and request IDs should be checked against its current documentation.

If a request returns an answer but its JSON is incomplete, use the JSON response troubleshooting guide to inspect the finish reason and syntax.

Free API access and limits

Check the site free API access and limits before trying to obtain a site key. Read the current status and request limits before using a site key. It is not a source of official provider keys.

ChinaGenAI is not affiliated with the providers named here. This release contains setup guidance and explicitly labeled fictional examples, not claimed live model benchmarks.

Exact symptom wording and source

Use the quoted text to locate the relevant check. Providers and clients can phrase the same failure differently; compare the complete response before applying a fix.

  • Reported text: 400 - Invalid Format

    Check the request body's JSON shape and the endpoint's documented parameters.

    Cause: Invalid request body format.

    DeepSeek error codes