API reference

API reference

OpenAI-compatible endpoints available through the AI service's /v1 base URL.

文

This guide has an independently written Vietnamese edition. Đọc bằng Tiếng Việt

SDK documentation · API v1

Base URL and authentication

Set the SDK base URL to https://taskway-ai-be.onrender.com/v1. Authenticate each request with Authorization: Bearer <application-key>. Provider keys and user-login tokens are not SDK credentials.

Models

Method and pathDescription
GET /v1/modelsList routing aliases and concrete models visible to the application.
GET /v1/models/{model}Retrieve one visible model or alias.

Both operations require an application key. A model name outside the application’s visible catalog returns 404 model_not_found.

Chat Completions

POST /v1/chat/completions accepts a Chat Completions body with a required model and non-empty messages array. It returns an OpenAI-shaped completion. Set stream: true for SSE. Strict idempotency requires the Idempotency-Key header.

Common fields include max_tokens or max_completion_tokens (one at a time), temperature, top_p, stop, seed, penalties, tools, tool_choice, parallel_tool_calls, response_format, n (1–4), stream, and stream_options.include_usage. Optional settings have a narrower accepted profile; check compatibility.

Responses

Method and pathDescription
POST /v1/responsesCreate a response.
GET /v1/responses/{response_id}Retrieve a stored response belonging to the application.
DELETE /v1/responses/{response_id}Delete a stored response.

Create uses model and input. store defaults to true; previous_response_id refers to a non-expired stored response from the same application. Create requests require idempotency under the default strict policy. See Responses and state for history semantics and unsupported fields.

Embeddings

POST /v1/embeddings requires model and input. Optional fields include encoding_format (float or base64), dimensions, and user. The implementation currently recognizes text-embedding-3-small and text-embedding-3-large; the application’s model/provider configuration must also expose an eligible model. Strict idempotency applies to this POST.

Files

Method and pathDescription
POST /v1/filesUpload a supported file as multipart form data (file, optional purpose, optional expires_after[anchor] and expires_after[seconds]).
GET /v1/filesList application-owned files (limit, after, order, purpose).
GET /v1/files/{file_id}Retrieve file metadata.
GET /v1/files/{file_id}/contentDownload file bytes.
DELETE /v1/files/{file_id}Delete an application-owned file.

Files and saved Responses are application-scoped. Read Files and attachments for media, expiry, and quota limits.

Request headers

HeaderPurpose
AuthorizationBearer application API key. Required for /v1 endpoints.
Content-TypeJSON for JSON endpoints; SDK multipart upload for Files.
Idempotency-KeyStable identifier required for generation/embedding create requests under the default strict profile.
x-request-idGateway request ID returned when available. Include it when diagnosing an error.

The SDK sets content and authorization headers for you when configured with the correct key and base URL.