Skip to content

Commit 15f5847

Browse files
JOYclaude
andcommitted
docs: update API reference and changelog sync
Updated chat completions and models API reference docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0c47167 commit 15f5847

2 files changed

Lines changed: 175 additions & 30 deletions

File tree

api-reference/chat-completions.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,116 @@ curl https://api.dos.ai/v1/chat/completions \
206206
"max_tokens": 256
207207
}'
208208
```
209+
210+
### Streaming (cURL)
211+
212+
```bash
213+
curl https://api.dos.ai/v1/chat/completions \
214+
-H "Content-Type: application/json" \
215+
-H "Authorization: Bearer dos_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
216+
-N \
217+
-d '{
218+
"model": "dos-ai",
219+
"messages": [
220+
{"role": "user", "content": "Write a haiku about programming."}
221+
],
222+
"stream": true
223+
}'
224+
```
225+
226+
### Using the OpenAI Python SDK
227+
228+
Since DOS AI is OpenAI-compatible, you can use the official OpenAI SDK by changing the base URL:
229+
230+
```python
231+
from openai import OpenAI
232+
233+
client = OpenAI(
234+
api_key="dos_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
235+
base_url="https://api.dos.ai/v1"
236+
)
237+
238+
response = client.chat.completions.create(
239+
model="dos-ai",
240+
messages=[
241+
{"role": "system", "content": "You are a helpful assistant."},
242+
{"role": "user", "content": "Explain quantum computing in simple terms."}
243+
],
244+
temperature=0.7,
245+
max_tokens=512
246+
)
247+
248+
print(response.choices[0].message.content)
249+
```
250+
251+
### Using the OpenAI Node.js SDK
252+
253+
```javascript
254+
import OpenAI from "openai";
255+
256+
const client = new OpenAI({
257+
apiKey: "dos_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
258+
baseURL: "https://api.dos.ai/v1",
259+
});
260+
261+
const response = await client.chat.completions.create({
262+
model: "dos-ai",
263+
messages: [
264+
{ role: "system", content: "You are a helpful assistant." },
265+
{ role: "user", content: "Explain quantum computing in simple terms." },
266+
],
267+
temperature: 0.7,
268+
max_tokens: 512,
269+
});
270+
271+
console.log(response.choices[0].message.content);
272+
```
273+
274+
### JSON Mode
275+
276+
```bash
277+
curl https://api.dos.ai/v1/chat/completions \
278+
-H "Content-Type: application/json" \
279+
-H "Authorization: Bearer dos_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
280+
-d '{
281+
"model": "dos-ai",
282+
"messages": [
283+
{"role": "system", "content": "Respond in JSON format."},
284+
{"role": "user", "content": "List 3 programming languages with their year of creation."}
285+
],
286+
"response_format": {"type": "json_object"}
287+
}'
288+
```
289+
290+
### Tool Calling Example
291+
292+
```bash
293+
curl https://api.dos.ai/v1/chat/completions \
294+
-H "Content-Type: application/json" \
295+
-H "Authorization: Bearer dos_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
296+
-d '{
297+
"model": "dos-ai",
298+
"messages": [
299+
{"role": "user", "content": "What is the weather in Tokyo?"}
300+
],
301+
"tools": [
302+
{
303+
"type": "function",
304+
"function": {
305+
"name": "get_weather",
306+
"description": "Get the current weather for a location",
307+
"parameters": {
308+
"type": "object",
309+
"properties": {
310+
"location": {
311+
"type": "string",
312+
"description": "City name"
313+
}
314+
},
315+
"required": ["location"]
316+
}
317+
}
318+
}
319+
]
320+
}'
321+
```

api-reference/models.md

Lines changed: 62 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Models
1+
# List Models
22

3-
Retrieve the list of models currently available on DOS AI.
3+
Retrieve the list of models currently available on the DOS AI platform. This endpoint is useful for dynamically discovering which models you can use without hard-coding model IDs.
44

55
## Endpoint
66

@@ -16,25 +16,13 @@ Include your API key in the `Authorization` header:
1616
Authorization: Bearer dos_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1717
```
1818

19-
## Response
20-
21-
Returns a JSON object containing a `data` array of model objects.
22-
23-
| Field | Type | Description |
24-
| ----- | ---- | ----------- |
25-
| `object` | string | Always `"list"` |
26-
| `data` | array | Array of model objects |
19+
## Request
2720

28-
### Model object
21+
No request body or query parameters are required.
2922

30-
| Field | Type | Description |
31-
| ----- | ---- | ----------- |
32-
| `id` | string | The model identifier used in API requests (e.g. `dos-ai`) |
33-
| `object` | string | Always `"model"` |
34-
| `created` | integer | Unix timestamp of when the model was registered |
35-
| `owned_by` | string | The organization that owns the model |
23+
## Response
3624

37-
### Example response
25+
### Success (200 OK)
3826

3927
```json
4028
{
@@ -43,20 +31,69 @@ Returns a JSON object containing a `data` array of model objects.
4331
{
4432
"id": "dos-ai",
4533
"object": "model",
46-
"created": 1700000000,
34+
"created": 1711000000,
35+
"owned_by": "dos-ai"
36+
},
37+
{
38+
"id": "llama-3.3-70b",
39+
"object": "model",
40+
"created": 1711000000,
41+
"owned_by": "dos-ai"
42+
},
43+
{
44+
"id": "deepseek-v3",
45+
"object": "model",
46+
"created": 1711000000,
47+
"owned_by": "dos-ai"
48+
},
49+
{
50+
"id": "llama-3.1-8b",
51+
"object": "model",
52+
"created": 1711000000,
4753
"owned_by": "dos-ai"
4854
}
4955
]
5056
}
5157
```
5258

59+
### Response Fields
60+
61+
| Field | Type | Description |
62+
| ----- | ---- | ----------- |
63+
| `object` | string | Always `"list"`. |
64+
| `data` | array | Array of model objects. |
65+
| `data[].id` | string | The model identifier. Use this as the `model` parameter in API requests. |
66+
| `data[].object` | string | Always `"model"`. |
67+
| `data[].created` | integer | Unix timestamp of when the model was added. |
68+
| `data[].owned_by` | string | The organization that owns the model. |
69+
70+
## Model ID Mapping
71+
72+
The `id` field is the value you use when specifying a model in API requests:
73+
74+
| Model Name | Model ID |
75+
| ---------- | -------- |
76+
| Qwen3.5-35B-A3B | `dos-ai` |
77+
| Llama 3.3 70B | `llama-3.3-70b` |
78+
| DeepSeek V3 | `deepseek-v3` |
79+
| Llama 3.1 8B | `llama-3.1-8b` |
80+
81+
## Error Responses
82+
83+
| Status Code | Description |
84+
| ----------- | ----------- |
85+
| 401 | Invalid or missing API key. |
86+
| 500 | Internal server error. |
87+
88+
See [Error Codes](../support/error-codes.md) for details.
89+
5390
## Examples
5491

5592
### cURL
5693

5794
```bash
5895
curl https://api.dos.ai/v1/models \
59-
-H "Authorization: Bearer dos_sk_..."
96+
-H "Authorization: Bearer dos_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
6097
```
6198

6299
### Python
@@ -65,34 +102,29 @@ curl https://api.dos.ai/v1/models \
65102
from openai import OpenAI
66103

67104
client = OpenAI(
68-
base_url="https://api.dos.ai/v1",
69-
api_key="dos_sk_...",
105+
api_key="dos_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
106+
base_url="https://api.dos.ai/v1"
70107
)
71108

72109
models = client.models.list()
73-
74110
for model in models.data:
75111
print(model.id)
76112
```
77113

78-
### JavaScript
114+
### Node.js
79115

80116
```javascript
81117
import OpenAI from "openai";
82118

83119
const client = new OpenAI({
120+
apiKey: "dos_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
84121
baseURL: "https://api.dos.ai/v1",
85-
apiKey: "dos_sk_...",
86122
});
87123

88124
const models = await client.models.list();
89-
90125
for (const model of models.data) {
91126
console.log(model.id);
92127
}
93128
```
94129

95-
## Notes
96-
97-
- The models endpoint is OpenAI-compatible. Any client or library that supports the OpenAI `/v1/models` endpoint will work without modification.
98-
- The list reflects models currently loaded and ready to serve requests. Available models may change over time -- see [Available Models](../models/available-models.md) for the full catalog and pricing.
130+
> **Note:** The list of available models may change over time as new models are added. We recommend fetching the model list dynamically rather than hard-coding model IDs in your application.

0 commit comments

Comments
 (0)