API Reference
Base URL: https://api.devlens.top
Authentication
All requests require a Bearer token in the Authorization header:
Authorization: Bearer sk-YOUR_KEYPOST /v1/chat/completions
Primary endpoint. Supports multi-turn conversation, streaming, and function calling.
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model identifier, e.g. gpt-5 |
messages | array | Yes | Conversation messages |
temperature | number | No | Sampling temperature, 0–2. Default: 1 |
max_tokens | number | No | Maximum tokens to generate |
stream | boolean | No | Enable SSE streaming. Default: false |
top_p | number | No | Nucleus sampling, 0–1. Default: 1 |
frequency_penalty | number | No | 0–2. Default: 0 |
presence_penalty | number | No | 0–2. Default: 0 |
Message format
json
{
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello"},
{"role": "assistant", "content": "Hi — how can I help?"},
{"role": "user", "content": "Write a haiku"}
]
}Example
bash
curl https://api.devlens.top/v1/chat/completions \
-H "Authorization: Bearer sk-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5",
"messages": [{"role": "user", "content": "Hello"}],
"max_tokens": 4096
}'Response
json
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"model": "gpt-5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 8,
"total_tokens": 18
}
}Streaming
Set "stream": true. The response uses Server-Sent Events:
data: {"id":"chatcmpl-xxx","choices":[{"delta":{"content":"Hello"},"index":0}]}
data: {"id":"chatcmpl-xxx","choices":[{"delta":{"content":"!"},"index":0}]}
data: [DONE]POST /v1/completions
Legacy text completion. Use Chat Completions for most use cases.
POST /v1/embeddings
Convert text to vector representations.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Embedding model identifier |
input | string / array | Yes | Text to embed |
GET /v1/models
Returns available models for the authenticated key.
bash
curl https://api.devlens.top/v1/models \
-H "Authorization: Bearer sk-YOUR_KEY"