<!-- Generated from public website sources; do not edit this file. -->

> DSSUB design reference. Account, payments and API are not connected; prices, policies and setup examples require independent launch verification.

# Your first API call
Connect an agent to DSSUB or make a Chat Completions request with cURL, Python or Node.js.

## Current availability
DSSUB is a design preview. Account, payment and API services are not connected. The examples and expected behavior below are integration references, not a verified production contract. A `.invalid` endpoint cannot accept real requests.


## Connect an agent
Create an [API key](/account/keys), then follow the setup guide for your client.

- [Claude Code](/docs/claude-code/index.md) uses Anthropic Messages.
- [Codex](/docs/codex/index.md) uses the Responses API.
- [OpenCode](/docs/opencode/index.md), [OpenClaw](/docs/openclaw/index.md), [Hermes Agent](/docs/hermes/index.md), [DeepSeek Harness](/docs/deepseek-harness/index.md) and [Pi](/docs/pi/index.md) use Chat Completions.

## Get your connection details
Keep these three values from the same provider. A subscription key cannot automatically be used with the official DeepSeek endpoint.

| Setting | What to use |
| --- | --- |
| API key | A key issued by your API provider |
| Base URL | The provider's OpenAI-compatible API base, including any required version prefix |
| Model | The exact model ID enabled for your account |

The [API keys preview](/account/keys) contains sample data only. `https://api.dssub.invalid/v1` is an example base, not a real connection. Wait for verified connection details and an authorized key before sending a request.

## Set environment variables
### macOS / Linux
Set these in the terminal where you will run your code. Include a version prefix such as `/v1` only if your provider requires it; omit the final slash.

```sh
export DSSUB_API_KEY="your-api-key"
export DSSUB_BASE_URL="https://your-provider.example/v1"
export DSSUB_MODEL="deepseek-flash"
```

### Windows PowerShell
```powershell
$env:DSSUB_API_KEY = "your-api-key"
$env:DSSUB_BASE_URL = "https://your-provider.example/v1"
$env:DSSUB_MODEL = "deepseek-flash"
```

Environment variables apply to the current terminal session. Run the Python or Node.js example below in that same terminal on either platform. The cURL example uses macOS / Linux shell syntax.

## Send a request
Choose a language. Python requires `python -m pip install openai`; Node.js requires `npm install openai` and an `.mjs` file. These examples send one short request, which may consume allowance.

```sh
curl --fail-with-body "$DSSUB_BASE_URL/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DSSUB_API_KEY" \
  -d "{\"model\":\"$DSSUB_MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Say hello in one sentence.\"}],\"stream\":false}"
```

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["DSSUB_API_KEY"],
    base_url=os.environ["DSSUB_BASE_URL"],
)
response = client.chat.completions.create(
    model=os.environ["DSSUB_MODEL"],
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
    stream=False,
)
print(response.choices[0].message.content)
```

```javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.DSSUB_API_KEY,
  baseURL: process.env.DSSUB_BASE_URL,
});
const response = await client.chat.completions.create({
  model: process.env.DSSUB_MODEL,
  messages: [{ role: "user", content: "Say hello in one sentence." }],
  stream: false,
});
console.log(response.choices[0].message.content);
```

## Read the response
The assistant's answer is in `choices[0].message.content`. Below is an illustrative excerpt; actual text and token counts vary.

```json
{
  "choices": [{
    "message": { "role": "assistant", "content": "Hello! How can I help?" },
    "finish_reason": "stop"
  }],
  "usage": { "prompt_tokens": 12, "completion_tokens": 8, "total_tokens": 20 }
}
```

Check the returned usage fields against [Usage](/account/usage) and your [plan windows](/account/plan). Pending requests may temporarily reserve allowance or credit until settled.

If the request fails, use the HTTP status and response message with the [error guide](/docs/error-codes/index.md). Check the endpoint path before changing your key.

## Keep building
- [Stream a response](/docs/streaming/index.md) to display text as it arrives.
- [Continue a conversation](/docs/multi-turn/index.md) by sending message history.
- [Understand token usage](/docs/token-usage/index.md) before scaling up requests.

Official provider keys and connection settings belong to the official service. See [models and API compatibility](/docs/models/index.md) for the distinction.

---

HTML source: [Your first API call — dssub Tutorials](/docs/quickstart/)
