Build on DeepAstra

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.

Get an API keyQuickstart

Introduction

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.

  • Base URL: https://api.deepastra.ai/v1
  • Auth: a bearer dak_live_… API key
  • Endpoints: /chat/completions, /responses, /models, /embeddings

Authentication

Authenticate with a bearer API key: Authorization: Bearer dak_live_…. Keys are scoped to a project and carry your organization's billing.

Create a key

  1. 1. Open the console → API Keys.
  2. 2. Create key, pick a project, name it.
  3. 3. Copy it immediately — it's shown onceand can't be retrieved again.
Go to API Keys

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.

Quickstart

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!"}]
  }'

SDKs

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.

API reference

All endpoints are under https://api.deepastra.ai/v1. * marks required parameters.

POST/chat/completionsCreate chat completion

Generate a model response for a conversation. Supports streaming, tools, vision, structured output, and the DeepAstra reasoning control.

ParameterTypeDescription
model*stringA model id from GET /v1/models (case-insensitive).
messages*arrayThe conversation. Multiple system messages are merged into one leading message.
streambooleanStream the response as Server-Sent Events.
max_tokensintegerMaximum tokens to generate.
temperaturenumberSampling temperature (0–2).
toolsarrayFunction/tool definitions the model may call.
response_formatobject{ "type": "json_object" } for guaranteed JSON.
reasoningobjectDeepAstra control: { enabled: boolean, effort: string }. Accepted effort levels are model-dependent — see each family's ladder under Model families & capabilities.
POST/responsesCreate a response (Responses API)

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.

ParameterTypeDescription
model*stringA model whose capabilities include "responses" on GET /v1/models.
input*string | arrayThe input text or item array (messages with input_text / input_image parts, function_call_output, …). Send the full input each turn.
instructionsstringSystem/developer instructions for this response.
streambooleanStream typed Server-Sent Events.
max_output_tokensintegerMaximum tokens to generate (reasoning included).
toolsarrayFunction tools only (flat Responses shape: {type, name, parameters}). Hosted tools are rejected.
textobject{ "format": {"type": "json_object" | "json_schema", ...} } for structured output.
reasoningobjectNative OpenAI Responses param ({ effort, summary }) — passed through to the model untouched.
temperaturenumberSampling temperature (0–2).
GET/modelsList models

List available models with DeepAstra's probe-verified capability metadata (capabilities, supported_parameters, architecture, context_length).

GET/models/{id}Retrieve a model

Get one model's metadata by id.

ParameterTypeDescription
id*stringThe model id (path parameter, case-insensitive).
POST/embeddingsCreate embeddings

Generate embedding vectors for text, on embedding-capable models.

ParameterTypeDescription
model*stringAn embedding-capable model id.
input*string | arrayText, 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"
json
{
  "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"]
    }
  ]
}

Model families & capabilities

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.

glm-5.2glm-4.6glm-4.6vglm-4.6v-flashxglm-4.6v-flashContext: Up to ~1M tokens (model-dependent)
CapabilitySupportNotes
Chat completionsSupported
StreamingSupported
Tool / function callingSupportedNative OpenAI shape (tools + tool_choice); strong agentic tool use, up to 128 functions.
Structured output (JSON)Automaticresponse_format is supported; DeepAstra disables thinking for reliable JSON and reports it as structured-thinking-off in x-deepastra-adapted.
Vision (image input)Model-dependentOn 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.
ReasoningSupportedUnified reasoning control → native thinking + effort.

Reasoning: On by default — toggle with the reasoning control

Effort levelsminimallowmediumhighxhighmax

Thinking returns in message.reasoning_content. Send reasoning: { enabled: false } to turn it off, or reasoning: { effort: "…" } to set a level.

Streaming

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}'

Reasoning

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:

json
{
  "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 }
  }
}

Structured output

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"}
  }'

Vision

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.

Responses API

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:

  • store is always false — DeepAstra never persists responses (forced off and disclosed as store-off in x-deepastra-adapted when your request asked otherwise)
  • previous_response_id and conversation are rejected — send the full input each turn
  • background, stored prompt templates (prompt), hosted tools (web_search, file_search, …), item_reference items, and file_id references (in input content or a tool call's output) are rejected — only function tools and inline content
  • prompt_cache_key, safety_identifier, and user are dropped (disclosed via x-deepastra-adapted) — they address a shared provider account and aren't brokered per tenant

Rejected parameters return 400 unsupported_parameter naming the parameter.

Request adaptations

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.

Rate limits

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.

Response headers

HeaderDescription
x-request-idUnique id for the request — include it when reporting an issue.
x-ratelimit-limit-requests, x-ratelimit-remaining-requests, x-ratelimit-reset-requestsPer-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-tokensPer-minute token quota, remaining, and reset.
retry-afterSeconds 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-adaptedInformational. 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-replayedtrue when a response was replayed for a repeated Idempotency-Key (see Idempotency).

Errors

Errors use the OpenAI envelope with a machine-readable code:

json
{
  "error": {
    "message": "the model does not exist or is not available",
    "type": "invalid_request_error",
    "code": "model_not_found"
  }
}
StatusCodeMeaning
400invalid_json / missing_model / invalid_requestThe request was malformed — invalid JSON, a missing `model`, or a body that couldn't be processed.
400unsupported_parameterA /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.
401invalid_api_keyThe API key is missing or invalid.
402insufficient_quotaYour organization is out of credit.
403insufficient_scopeThe API key lacks the scope for this endpoint.
404model_not_foundThe model does not exist, or isn't available to your key.
413request_too_largeThe request body exceeds the size limit.
429rate_limit_exceededYour request or token rate limit — wait `Retry-After` seconds and retry.
429model_at_capacityThe model is momentarily at capacity — wait `Retry-After` (short) and retry.
429model_quota_exhaustedThe 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.
502provider_errorThe upstream model provider errored or was unreachable — retry with backoff.
503provider_errorThe model is busy upstream (NOT your limit) — wait `Retry-After` seconds and retry.
503service_unavailableA 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.