---
title: DeepSeek API: prices, model ids and a working request
date: 2026-11-23T17:42:10Z
canonical: https://ai.layercloud.org/blog/deepseek-api-rahnam
author: LayerCloud
tags: deepseek, api, pricing, guide
---

# DeepSeek API: prices, model ids and a working request

> The three DeepSeek models on the gateway with real prices, the exact ids to use, a curl and Python example, and where the 404s come from.

DeepSeek is one of the most used model families among Iranian developers, for one plain reason: quality per dollar. Three of them are live on this gateway, and the differences matter more than the names suggest.

This guide gives the real prices, the exact ids to put in your code, and a working request.

## Three models, three jobs

| Model | Input (per 1M) | Output | Context | Use it for |
| --- | --- | --- | --- | --- |
| deepseek/deepseek-v4-flash-0731 | 0.0163 | 0.045 | 1.3M | Cheapest option at volume |
| deepseek/deepseek-v4.1-flash | 0.0375 | 0.15 | 1M | Newer, better quality |
| deepseek/deepseek-v4-pro-0813 | 0.2802 | 0.8405 | 1M | Hard, multi-step work |

The cheapest input price is about 17x below the most expensive one here, which is what decides everyday cost.

## Where the model id comes from

This is where most failures start. The vendor's own names (`deepseek-chat` and friends) are not valid here; the id must be the one the catalogue returns.

```bash
curl https://ai.layercloud.org/v1/models \
  -H "Authorization: Bearer $LAYERCLOUD_API_KEY"
```

Each entry carries a `name` that includes the provider prefix. Put that exact value in the request's `model` field. A short name or a display name returns 404.

## First request

```bash
curl https://ai.layercloud.org/v1/chat/completions \
  -H "Authorization: Bearer $LAYERCLOUD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4.1-flash",
    "messages": [{"role": "user", "content": "write a Python function that reads a CSV"}]
  }'
```

With the official OpenAI SDK it is two lines; only `base_url` changes:

```python
from openai import OpenAI

client = OpenAI(api_key="...", base_url="https://ai.layercloud.org/v1")
r = client.chat.completions.create(
    model="deepseek/deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "write a Python function that reads a CSV"}],
)
print(r.choices[0].message.content)
```

## What it costs

A typical coding request is about 30k input and 4k output tokens.

- `deepseek-v4-flash-0731`: about $0.0007 per request.
- `deepseek-v4.1-flash`: about $0.0017.
- `deepseek-v4-pro-0813`: about $0.0118.

A thousand requests a day on the cheap model stays under a dollar. For most teams the binding constraint becomes quota and latency, not money.

## Details that save time

**Take the context seriously.** The cheap model has a 1.3M window, so several large files fit in one call. Input is metered too, so a bigger prompt is a bigger bill.

**Keep output short.** Output costs several times more than input. If you only want a small change, say so in the prompt and ask for just that block.

**Stream when a human is watching a UI.** Irrelevant for a CLI, very relevant for a web interface.

**Keep the model name in configuration.** A new model or a price change then costs one line, not a deploy.

## When to escalate

If the cheap model gets it wrong twice in a row, or the task becomes a rewrite across several large files, resend that one request to `deepseek-v4-pro-0813`. Same for the final review of an important change. "Cheap default, escalate on demand" usually cuts spend several times over without a visible quality drop.

## FAQ

**Do the models differ in output or only in price?**
Both. The pro model is better at multi-step reasoning and instruction-following; flash is enough for editing existing code.

**Why do I get a 404?**
Almost always the model name. Read the id from the model list and check you did not drop the provider prefix.

**Can I compare models?**
Yes, with the same key and the same code. Change the model string and watch the two requests in the panel.

**Does it work for Cursor or opencode?**
Yes, the base URL is OpenAI-compatible; the [Cursor setup guide](/blog/cursor-api-hoosh-masnooei) has the details.

Live prices are on the [pricing page](/pricing), and [the coding-model comparison](/blog/behtarin-model-coding) explains which model fits which job.

