DeepAstra is a unified AI platform API — one endpoint, one key, and many models for chat, tools, vision, structured output, and reasoning, with each capability verified per model. It speaks the OpenAI protocol, so the SDKs and tools you already use work out of the box.
DeepAstra gives you a single, capability-aware surface over many models. Every model advertises what it can actually do — probed and verified by DeepAstra — and one request works across all of them. Because DeepAstra is protocol-compatible, existing OpenAI clients need no rewrite: change the base URL and key, and you're on DeepAstra.
https://api.deepastra.ai/v1dak_live_… API key/chat/completions, /responses, /models, /embeddingsAuthenticate with a bearer API key: Authorization: Bearer dak_live_…. Keys are scoped to a project and carry your organization's billing.
Create a key
Keep keys secret. Never ship a key in client-side code or commit it — call DeepAstra from your backend and store the key in an environment variable.
Set the base URL and key, list models to pick one, then call chat/completions:
curl https://api.deepastra.ai/v1/chat/completions \
-H "Authorization: Bearer $DEEPASTRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<model>",
"messages": [{"role": "user", "content": "Hello, DeepAstra!"}]
}'Any OpenAI SDK works with DeepAstra today — set the base URL and your DeepAstra key. A native DeepAstra SDK is on the way.
# No SDK needed — DeepAstra is plain HTTP. Any HTTP client works.
# The examples on this page use cURL for the raw requests.All endpoints are under https://api.deepastra.ai/v1. * marks required parameters.
Generate a model response for a conversation. Supports streaming, tools, vision, structured output, and the DeepAstra reasoning control.
| Parameter | Type | Description |
|---|---|---|
| model* | string | A model id from GET /v1/models (case-insensitive). |
| messages* | array | The conversation. Multiple system messages are merged into one leading message. |
| stream | boolean | Stream the response as Server-Sent Events. |
| max_tokens | integer | Maximum tokens to generate. |
| temperature | number | Sampling temperature (0–2). |
| tools | array | Function/tool definitions the model may call. |
| response_format | object | { "type": "json_object" } for guaranteed JSON. |
| reasoning | object | DeepAstra control: { enabled: boolean, effort: string }. Accepted effort levels are model-dependent — see each family's ladder under Model families & capabilities. |
The OpenAI Responses API, served stateless on responses-capable models. Streaming emits the standard typed events (response.created, response.output_text.delta, response.completed). store is always false; previous_response_id, conversation, background, stored prompts, hosted tools, and file_id references are rejected with 400 unsupported_parameter.
| Parameter | Type | Description |
|---|---|---|
| model* | string | A model whose capabilities include "responses" on GET /v1/models. |
| input* | string | array | The input text or item array (messages with input_text / input_image parts, function_call_output, …). Send the full input each turn. |
| instructions | string | System/developer instructions for this response. |
| stream | boolean | Stream typed Server-Sent Events. |
| max_output_tokens | integer | Maximum tokens to generate (reasoning included). |
| tools | array | Function tools only (flat Responses shape: {type, name, parameters}). Hosted tools are rejected. |
| text | object | { "format": {"type": "json_object" | "json_schema", ...} } for structured output. |
| reasoning | object | Native OpenAI Responses param ({ effort, summary }) — passed through to the model untouched. |
| temperature | number | Sampling temperature (0–2). |
List available models with DeepAstra's probe-verified capability metadata (capabilities, supported_parameters, architecture, context_length).
Get one model's metadata by id.
| Parameter | Type | Description |
|---|---|---|
| id* | string | The model id (path parameter, case-insensitive). |
Generate embedding vectors for text, on embedding-capable models.
| Parameter | Type | Description |
|---|---|---|
| model* | string | An embedding-capable model id. |
| input* | string | array | Text, or an array of texts, to embed. |
A GET /models response — note DeepAstra's verified capabilities and supported_parameters:
curl https://api.deepastra.ai/v1/models -H "Authorization: Bearer $DEEPASTRA_API_KEY"{
"object": "list",
"data": [
{
"id": "<model>",
"object": "model",
"owned_by": "deepastra-api",
"context_length": 1000000,
"max_output_tokens": 131072,
"architecture": { "input_modalities": ["text", "image"], "output_modalities": ["text"] },
"capabilities": ["chat_completions", "streaming", "tools", "structured_output", "reasoning", "responses", "vision"],
"supported_parameters": ["max_tokens", "temperature", "top_p", "tools", "response_format", "reasoning"]
}
]
}Every family speaks the same OpenAI-compatible surface and the same unified reasoningcontrol — the only differences are which capabilities light up and which reasoning-effort levels a model accepts. The tables below are DeepAstra's probe-verified capabilities; the live, per-model source of truth is always GET /v1/models (capabilities and supported_parameters).
Agentic, coding-strong flagship family. Thinking is on by default and tool use is native — well suited to multi-step agents and code.
| Capability | Support | Notes |
|---|---|---|
| Chat completions | Supported | — |
| Streaming | Supported | — |
| Tool / function calling | Supported | Native OpenAI shape (tools + tool_choice); strong agentic tool use, up to 128 functions. |
| Structured output (JSON) | Automatic | response_format is supported; DeepAstra disables thinking for reliable JSON and reports it as structured-thinking-off in x-deepastra-adapted. |
| Vision (image input) | Model-dependent | On the vision models — glm-4.6v (and the lighter glm-4.6v-flashx / glm-4.6v-flash). Confirm vision is in the model's capabilities on GET /v1/models. |
| Reasoning | Supported | Unified reasoning control → native thinking + effort. |
Reasoning: On by default — toggle with the reasoning control
minimallowmediumhighxhighmaxThinking returns in message.reasoning_content. Send reasoning: { enabled: false } to turn it off, or reasoning: { effort: "…" } to set a level.
Set stream: true for token-by-token Server-Sent Events (a final chunk carries usage):
curl https://api.deepastra.ai/v1/chat/completions \
-H "Authorization: Bearer $DEEPASTRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "<model>", "messages": [{"role": "user", "content": "Count from 1 to 5."}], "stream": true}'DeepAstra exposes a unified reasoning control — one shape across models. Pass reasoningto turn thinking on/off or set effort; DeepAstra translates it to each model's native mechanism. In the OpenAI SDKs, pass it via extra_body.
curl https://api.deepastra.ai/v1/chat/completions \
-H "Authorization: Bearer $DEEPASTRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<model>",
"messages": [{"role": "user", "content": "What is 23 * 47?"}],
"reasoning": {"enabled": false}
}'When reasoning runs, the model's thinking comes back alongside the answer — in message.reasoning_content (and delta.reasoning_content while streaming). Reasoning tokens are billed and reported under usage.completion_tokens_details.reasoning_tokens:
{
"choices": [{
"message": {
"role": "assistant",
"reasoning_content": "23 * 47 = 23 * 40 + 23 * 7 = 920 + 161 ...",
"content": "23 * 47 = 1081."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 18,
"completion_tokens": 96,
"completion_tokens_details": { "reasoning_tokens": 84 }
}
}Ask for guaranteed JSON with response_format. DeepAstra applies each model's verified settings, so you get valid JSON regardless of the model's reasoning behavior:
curl https://api.deepastra.ai/v1/chat/completions \
-H "Authorization: Bearer $DEEPASTRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<model>",
"messages": [{"role": "user", "content": "Give a city and its country as JSON."}],
"response_format": {"type": "json_object"}
}'Send images alongside text using standard OpenAI content parts. Only models whose capabilities include vision on GET /v1/models accept image input — on GLM those are glm-4.6v and the lighter glm-4.6v-flashx / glm-4.6v-flash. Pass a public URL or an inline data: URI, and send multiple images per message if you need:
# Send an image with your prompt. Use a model whose GET /v1/models "capabilities" include "vision".
curl https://api.deepastra.ai/v1/chat/completions \
-H "Authorization: Bearer $DEEPASTRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<model>",
"messages": [{"role": "user", "content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}
]}]
}'Prefer base64 data URLs. A remote image_url is fetched server-side by the model provider, so images on hosts that block non-browser clients (many news sites and CDNs) can fail to load. Inlining the bytes as a data:image/…;base64,… URL is the most reliable path; keeping images to ~1280px also lowers latency and token cost.
DeepAstra serves the OpenAI Responses API at POST /responses on models whose capabilities include responses. client.responses.create(...) in the OpenAI SDKs works unchanged, including streaming (typed events like response.output_text.delta) and the native reasoning parameter:
# The OpenAI Responses API, served stateless. Use a model whose capabilities include "responses".
curl https://api.deepastra.ai/v1/responses \
-H "Authorization: Bearer $DEEPASTRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<model>",
"input": "Write a haiku about the sea.",
"max_output_tokens": 200
}'Served stateless:
Rejected parameters return 400 unsupported_parameter naming the parameter.
So a single request works across every model, the DeepAstra gateway normalizes it for the target model on your behalf — and tells you what it did in the x-deepastra-adapted response header. You always send standard OpenAI; DeepAstra handles the per-model differences:
system-mergedMultiple system messages are merged into one leading message.reasoning-offYour reasoningcontrol is translated to the model's native mechanism.structured-thinking-offA response_formatrequest gets the model's verified settings for reliable JSON.tool-choice-thinking-offA forced tool_choice ("required"or a named function) gets the model's verified settings so the tool call is honored.Every API key carries per-minute request (RPM) and token (TPM) limits plus a daily request cap (RPD). Your organization starts on the default tier and limits grow with your usage; a subscription package raises them further, and an org owner or admin can pin an individual key tighter from the console (never looser — key pins are a safety cap, not an upgrade path). Your current limits, remaining allowance, and reset time are on every response in the x-ratelimit-* headers below.
Exceeding a limit returns 429 rate_limit_exceeded with a retry-after header — wait that many seconds and retry (the OpenAI SDKs do this automatically). Sustained 429s mean you need a higher tier or package, not tighter retry loops.
Cached input is cheaper. When a model reports cache-read input tokens (prompt_tokens_details.cached_tokens in the usage block), those tokens are billed at the model's discounted cached-input rate instead of the full input rate — shown as cached_input_per_1m on the models catalog. Repeated context (agent loops, long conversations) costs you less automatically; no code changes needed.
| Header | Description |
|---|---|
| x-request-id | Unique id for the request — include it when reporting an issue. |
| x-ratelimit-limit-requests, x-ratelimit-remaining-requests, x-ratelimit-reset-requests | Per-minute request quota, remaining, and reset (present when a limit is configured for your key). |
| x-ratelimit-limit-tokens, x-ratelimit-remaining-tokens, x-ratelimit-reset-tokens | Per-minute token quota, remaining, and reset. |
| retry-after | Seconds to wait before retrying — sent on a 429 (your rate limit) and on a 503 when the model is busy upstream (a provider's own Retry-After is honored). The OpenAI SDKs back off on it automatically. |
| x-deepastra-adapted | Informational. Present when the gateway adapted your request for the target model — e.g. reasoning-off, structured-thinking-off, system-merged, or store-off on /responses. Your request still speaks standard OpenAI; this just tells you what DeepAstra did on your behalf. |
| idempotent-replayed | true when a response was replayed for a repeated Idempotency-Key (see Idempotency). |
Errors use the OpenAI envelope with a machine-readable code:
{
"error": {
"message": "the model does not exist or is not available",
"type": "invalid_request_error",
"code": "model_not_found"
}
}| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_json / missing_model / invalid_request | The request was malformed — invalid JSON, a missing `model`, or a body that couldn't be processed. |
| 400 | unsupported_parameter | A /responses request used a stateful feature DeepAstra doesn't serve (previous_response_id, conversation, background, stored prompts, hosted tools, file_id) — the message names the parameter. |
| 401 | invalid_api_key | The API key is missing or invalid. |
| 402 | insufficient_quota | Your organization is out of credit. |
| 403 | insufficient_scope | The API key lacks the scope for this endpoint. |
| 404 | model_not_found | The model does not exist, or isn't available to your key. |
| 413 | request_too_large | The request body exceeds the size limit. |
| 429 | rate_limit_exceeded | Your request or token rate limit — wait `Retry-After` seconds and retry. |
| 429 | model_at_capacity | The model is momentarily at capacity — wait `Retry-After` (short) and retry. |
| 429 | model_quota_exhausted | The model's upstream capacity allowance is used up for the current window — retrying now won't help; `Retry-After` is long and the message includes the reset time when known. |
| 502 | provider_error | The upstream model provider errored or was unreachable — retry with backoff. |
| 503 | provider_error | The model is busy upstream (NOT your limit) — wait `Retry-After` seconds and retry. |
| 503 | service_unavailable | A DeepAstra dependency (auth, catalog, routing) is temporarily unavailable — retry with backoff. |
Ready to build? Create an API key, list models, and make your first call.