API 文件
Use the OpenAI-compatible base URL with Aiduct API keys.
OPENAI_BASE_URL=https://api.aiduct.ai/v1
OPENAI_API_KEY=your_aiduct_api_key
post/v1/chat/completions
Create a chat completion
OpenAI ChatCompletion-compatible endpoint. Set `stream: true` to receive a Server-Sent Events stream where each `data:` line is a `chat.completion.chunk` payload terminated by `data: [DONE]`. Model id is the API-platform id from `GET /v1...
post/v1/messages
Anthropic Messages (Claude Code protocol)
Anthropic's Messages protocol, for Claude Code (`ANTHROPIC_BASE_URL=https://api.aiduct.ai`, no `/v1`) and the Anthropic SDKs. Every catalog chat model answers here: Claude models natively, others translated, with tool use, thinking and i...
post/v1/messages/count_tokens
Count the input tokens of a Messages request
Anthropic's token-counting endpoint. A model served natively on this protocol is counted by its upstream; any other count is an estimate, marked by `x-aiduct-token-count: estimated`. Not billed.
post/v1/responses
OpenAI Responses API (Codex CLI protocol)
OpenAI's Responses protocol, for the Codex CLI (a model provider with `base_url = "https://api.aiduct.ai/v1"` and `wire_api = "responses"`) and `responses.create` in the OpenAI SDKs. Every catalog chat model answers here: OpenAI models n...
post/v1/responses/input_tokens
Count the input tokens of a Responses request
OpenAI's input-token counting endpoint. A model served natively on this protocol is counted by its upstream; any other count is an estimate, marked by `x-aiduct-token-count: estimated`. Not billed.
post/v1beta/models/{model}:generateContent
Gemini generateContent
Google's Gemini protocol, for the Gemini CLI (`GOOGLE_GEMINI_BASE_URL=https://api.aiduct.ai`), `@google/genai` (`httpOptions.baseUrl`) and pi. Every catalog chat model answers here: Gemini models natively, others translated, with functio...
post/v1beta/models/{model}:streamGenerateContent
Gemini streamGenerateContent
The streamed form of `generateContent`. Send `?alt=sse` for a server-sent event per `GenerateContentResponse` chunk, as the Gemini SDKs do.
post/v1beta/models/{model}:countTokens
Gemini countTokens
Gemini's token-counting endpoint. A model served natively on this protocol is counted by its upstream; any other count is an estimate, marked by `x-aiduct-token-count: estimated`. Not billed.
post/v1/images/generations
Generate or edit an image from a prompt
OpenAI Images-compatible endpoint. Some models, such as `gpt-image-2`, also accept `input_media` reference images. No streaming.
post/v1/videos/generations
Submit an async video-generation job
Always async. Returns a queue ticket; poll the `status_url` until the job completes, then read the final result from `response_url`. Use `cancel_url` to abort. Optional `webhook_url` lets us POST `response.completed` to a customer endpoi...
get/v1/queue/requests/{id}
Fetch the queued job's result (or terminal-state payload)
200 with the final result when status is `completed`. 200 with `{status:'failed'|'cancelled', error, ...}` when terminal but unsuccessful (no body retry, just inspect). 202 with the polling payload when still in progress.
get/v1/queue/requests/{id}/status
Cheap poll of a job's current state
Always returns 200 with the latest status. Safe to call at sub-second cadence — does not touch upstream providers.
post/v1/queue/requests/{id}/cancel
Cancel a queued job
Marks the job as cancelled and best-effort asks the upstream provider to stop. Does NOT refund compute already consumed. Returns 409 if the job is already in a terminal state.
post/v1/embeddings
Create vector embeddings for text input
OpenAI-compatible embeddings endpoint. Pass a single string or an array; receive one float (or base64) vector per input. Use `text-embedding-3-small` for cheap baselines and `text-embedding-3-large` for higher retrieval quality.
post/v1/audio/speech
Generate speech or queued music from text
Model-specific audio generation endpoint. Speech models return audio bytes synchronously. `minimax-music-v2` returns a 202 queue ticket and rejects speech-only fields such as `voice` and `speed`.
post/v1/audio/transcriptions
Transcribe audio into text
OpenAI-compatible multipart speech-to-text endpoint. The gateway returns JSON transcription responses.
get/v1/models
OpenAI-compatible model list
Returns every model the gateway can route to in OpenAI's `{object:'list', data:[…]}` shape, augmented with `available`, `display_name`, `description`, and `pricing`. A request carrying `anthropic-version`, as the Anthropic SDKs send, get...
get/v1/models/{model}
Retrieve one model
One model by its catalog id or a declared alias, in OpenAI's shape, or Anthropic's when the request carries `anthropic-version`.
get/v1beta/models
Gemini models.list
The chat models as Gemini `Model` resources named `models/{id}`, each supporting `generateContent`, `streamGenerateContent` and `countTokens`.
get/v1beta/models/{model}
Gemini models.get
One chat model as a Gemini `Model` resource.
get/v1/models/catalog
SEO-friendly merged model catalog
Slug-friendly catalog used by aiduct.ai marketing pages. Includes pre-formatted price labels and a single-line price summary. Cached 60s.