> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ruapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# DeepSeek API: the budget pick for code and reasoning

> Why DeepSeek is the best value on price and quality, how V4 Pro and Flash differ, where the family shines (code, reasoning) and what it can't do (no vision). Connect over the OpenAI-compatible protocol.

People reach for DeepSeek for one reason: near-top-tier quality on code and reasoning, but noticeably cheaper than the rest. The family has two models — the flagship `deepseek-v4-pro` and the fast, low-cost `deepseek-v4-flash`. Both are text-only, have a long context window, and speak the OpenAI-compatible protocol. This page covers when DeepSeek pays off, what it does well, and what it can't do.

## Why DeepSeek is the budget pick

The main argument is price-to-quality. DeepSeek delivers results close to top-tier models on code and logic, but its tokens cost far less. If you run high request volumes, long documents, or a CI pipeline where every cent counts, DeepSeek usually cuts the bill to a fraction of what it was, with no meaningful quality loss.

* **Per-token price** — among the lowest of any strong model; `deepseek-v4-flash` is cheaper still than the flagship.
* **Quality** — reasoning and code stay close to the top tier, not "economy class."
* **Volume** — the long context lets you avoid chopping documents into tiny pieces.

For exact per-token prices, see the **Pricing** page at [www.ruapi.ai](https://www.ruapi.ai).

## Pro vs Flash — which one

|                  | `deepseek-v4-pro`                                    | `deepseek-v4-flash`               |
| ---------------- | ---------------------------------------------------- | --------------------------------- |
| Role             | Flagship                                             | Fast and cheap                    |
| Strong at        | Best quality: hard code, careful reasoning, analysis | Speed and price on everyday tasks |
| Function calling | Reliable tool use                                    | Basic, for simple flows           |
| Price            | Higher (still cheap)                                 | The lowest                        |
| Reach for it     | Hard tasks, agents                                   | Chat, classification, high volume |

<Tip>
  Not sure? Start with Flash — it's fast, costs next to nothing, and covers most work. Move up to Pro where you need the best result: hard code, precise reasoning, reliable tool use.
</Tip>

## Where DeepSeek is strong: code and reasoning

These are the two areas the family is built around.

* **Code** — Pro confidently writes, completes, and refactors code, explains errors, and suggests fixes. A good fit for autocomplete, review, and test generation.
* **Reasoning** — the model works through hard problems step by step: math, logic, requirement analysis, agent action planning.
* **Long context** — large files and documents fit in the window whole, no chunking.
* **Function calling** — Pro returns structured tool calls; see [function calling](/en/function-calling) for a ready example.

For long answers it's handy to [stream the response](/en/streaming) token by token instead of waiting for the full generation.

## What DeepSeek can't do

<Note>
  DeepSeek models are **text-only**. You can't pass images as input — there's no vision: neither `deepseek-v4-pro` nor `deepseek-v4-flash` reads images, diagrams, or screenshots. If you need to interpret pictures, use a vision model — [Claude](/en/claude-api), [Gemini](/en/gemini-api), or [GLM-5V](/en/glm-api). The same key and the same `base_url` work across all families, so you can mix them: DeepSeek for text and code, a vision model for images.
</Note>

## Connecting DeepSeek

DeepSeek speaks the **OpenAI-compatible** protocol — no separate library needed. Take any OpenAI SDK, change the `base_url` to `https://www.ruapi.ai/v1`, and put the model ID you want in the `model` field:

```python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_RUAPI_KEY",
    base_url="https://www.ruapi.ai/v1",
)

resp = client.chat.completions.create(
    model="deepseek-v4-pro",   # or deepseek-v4-flash
    messages=[{"role": "user", "content": "Write a quicksort function in Python"}],
)
print(resp.choices[0].message.content)
```

Step-by-step setup, the key, and a first request in Python and curl are in the [Quickstart](/en/quickstart). Exact model IDs and prices are on the Pricing page at [www.ruapi.ai](https://www.ruapi.ai).

## Next

<CardGroup cols={2}>
  <Card title="Connect and first request" icon="bolt" href="/en/quickstart">
    base\_url, key, Python and curl code.
  </Card>

  <Card title="Claude models" icon="brain" href="/en/claude-api">
    Same key — top-tier quality and vision.
  </Card>

  <Card title="GLM models" icon="cube" href="/en/glm-api">
    Another strong value line, with a vision option (GLM-5V).
  </Card>
</CardGroup>
