DadGPT OpenAI-Compatible API Reference
This document describes how to use the DadGPT API with agentic coding tools like Cline, Roo Code, Continue, Aider, and other OpenAI-compatible clients.
Quick Start
Base URL
https://your-domain.com/v1
1. Create a DadGPT API Key
- Log in to DadGPT.
- Go to Settings -> API Keys.
- Click Create New API Key.
- Copy the key immediately. It is shown only once.
DadGPT API keys start with:
sk-dad_
2. Use the Key in Requests
All API requests require the key in the Authorization header:
Authorization: Bearer sk-dad_your_api_key_here
3. Configure Your Client
Use these values in any OpenAI-compatible app:
| Setting | Value |
|---|---|
| Provider | OpenAI-compatible |
| Base URL | https://your-domain.com/v1 |
| API Key | sk-dad_your_api_key_here |
| Model | dadgpt-default or dadgpt-beast |
Important: User Key vs Provider Key
There are two different API keys involved:
| Key | Used by | Example | Purpose |
|---|---|---|---|
| DadGPT API key | API users | sk-dad_... | Authenticates users to DadGPT |
| Provider API key | DadGPT server | DEEPSEEK_API_KEY, OPENROUTER_API_KEY, DASHSCOPE_API_KEY | Authenticates DadGPT to the upstream model provider |
If users see 401 Invalid API key after their sk-dad_... key is accepted, the problem is usually the server-side provider key, not the user's DadGPT key.
Server operators should verify the selected model's configured apiKeyEnv, baseURL, and provider key value.
Endpoints
POST /v1/chat/completions
Generate AI chat completions. Supports both streaming and non-streaming responses.
Request Body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | No | dadgpt-default | Model to use. Options: dadgpt-default, dadgpt-beast |
messages | array | Yes | - | Array of message objects with role and content |
stream | boolean | No | false | Whether to stream the response |
temperature | number | No | 0.9 | Sampling temperature (0-2) |
max_tokens | number | No | 4096 | Maximum tokens to generate |
top_p | number | No | 0.95 | Nucleus sampling parameter |
frequency_penalty | number | No | 0.5 | Frequency penalty (-2 to 2) |
presence_penalty | number | No | 0.5 | Presence penalty (-2 to 2) |
Message Object
{
"role": "user" | "assistant" | "system",
"content": "Your message here"
}
Example Request
curl -X POST https://your-domain.com/v1/chat/completions \
-H "Authorization: Bearer sk-dad_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "dadgpt-default",
"messages": [
{"role": "system", "content": "You are a helpful coding assistant"},
{"role": "user", "content": "Write a Python function to calculate fibonacci numbers"}
],
"stream": true
}'
Response (Non-Streaming)
{
"id": "chatcmpl-abc123xyz",
"object": "chat.completion",
"created": 1703123456,
"model": "dadgpt-default",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Here's a Python function..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 150,
"total_tokens": 175
}
}
Response (Streaming)
Streaming responses use Server-Sent Events (SSE):
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1703123456,"model":"dadgpt-default","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1703123456,"model":"dadgpt-default","choices":[{"index":0,"delta":{"content":"Here's"},"finish_reason":null}]}
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1703123456,"model":"dadgpt-default","choices":[{"index":0,"delta":{"content":" a"},"finish_reason":null}]}
...
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1703123456,"model":"dadgpt-default","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]
GET /v1/models
List available models.
Example Request
curl https://your-domain.com/v1/models \
-H "Authorization: Bearer sk-dad_your_api_key"
Response
{
"object": "list",
"data": [
{
"id": "dadgpt-default",
"object": "model",
"created": 1703123456,
"owned_by": "dadgpt"
},
{
"id": "dadgpt-beast",
"object": "model",
"created": 1703123456,
"owned_by": "dadgpt"
}
]
}
Models
| Model | Description | Token Cost |
|---|---|---|
dadgpt-default | Balanced model for general use | 1 token/request |
dadgpt-beast | Extended context, more detailed responses | 3 tokens/request |
Rate Limits
- Default: 60 requests per minute per API key
- Rate limit headers are included in responses:
X-RateLimit-Limit: Maximum requests per minuteX-RateLimit-Remaining: Remaining requests in current windowX-RateLimit-Reset: Unix timestamp when the limit resets
Error Responses
All errors follow the OpenAI error format:
{
"error": {
"message": "Error description",
"type": "error_type",
"param": null,
"code": "error_code"
}
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | missing_api_key | Missing Authorization: Bearer sk-dad_... header |
| 401 | invalid_api_key | Invalid DadGPT key, or upstream provider key rejected the selected model request |
| 401 | api_key_expired | API key has expired |
| 402 | insufficient_quota | Insufficient tokens in account |
| 403 | account_suspended | Account has been suspended |
| 429 | rate_limit_exceeded | Too many requests |
| 400 | invalid_request | Malformed request |
| 400 | model_not_found | Invalid model specified |
| 500 | internal_error | Server error |
Troubleshooting 401 Errors
Missing or invalid DadGPT key
Symptoms:
{
"error": {
"code": "missing_api_key"
}
}
Fix:
-H "Authorization: Bearer sk-dad_your_api_key"
Upstream provider key rejected
Symptoms in server logs:
[API v1] Request: model=deepseek-v4-flash
[API v1] Error: Error: 401 Invalid API key.
code: 'invalid_api_key'
Meaning: the user's DadGPT key passed validation, but the selected model provider rejected the server-side key.
Fix for server operators:
- Check the selected model in admin/model config.
- Verify
apiKeyEnvpoints to the right env var. - Verify the env var contains a valid provider key.
- Verify
baseURLmatches the provider. - Verify the model name is supported by that provider.
Example env vars:
DEEPSEEK_API_KEY=your_deepseek_key
OPENROUTER_API_KEY=your_openrouter_key
DASHSCOPE_API_KEY=your_dashscope_key
Tool Configurations
Cline (VS Code)
In your VS Code settings (settings.json):
{
"cline.apiProvider": "openai-compatible",
"cline.apiBaseUrl": "https://your-domain.com/v1",
"cline.apiKey": "sk-dad_your_api_key_here",
"cline.model": "dadgpt-default"
}
Roo Code
{
"roo.provider": "openai-compatible",
"roo.baseUrl": "https://your-domain.com/v1",
"roo.apiKey": "sk-dad_your_api_key_here",
"roo.model": "dadgpt-default"
}
Continue
In your Continue configuration (~/.continue/config.json):
{
"models": [
{
"title": "DadGPT",
"provider": "openai",
"model": "dadgpt-default",
"apiBase": "https://your-domain.com/v1",
"apiKey": "sk-dad_your_api_key_here"
}
]
}
Aider
export OPENAI_API_BASE=https://your-domain.com/v1
export OPENAI_API_KEY=sk-dad_your_api_key_here
aider --model dadgpt-default
OpenAI Python SDK
from openai import OpenAI
client = OpenAI(
api_key="sk-dad_your_api_key_here",
base_url="https://your-domain.com/v1"
)
response = client.chat.completions.create(
model="dadgpt-default",
messages=[
{"role": "user", "content": "Hello!"}
],
stream=True
)
for chunk in response:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
curl
curl -X POST https://your-domain.com/v1/chat/completions \
-H "Authorization: Bearer sk-dad_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "dadgpt-default",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Best Practices
- Keep your API key secure - Never commit API keys to version control
- Use environment variables - Store keys in environment variables, not code
- Handle rate limits - Implement exponential backoff for 429 responses
- Use streaming for long responses - Streaming provides better UX for code generation
- Monitor your usage - Check the Settings page for API usage statistics
Support
- Telegram: @Automax_0
- Issues: Create an issue on GitHub