Configuration
To use the OpenAI SDKs with NEAR AI Cloud, you simply need to override thebase_url and provide your NEAR AI api_key.
Base URL
Use the NEAR AI Cloud Gateway base URL:API Key
You can generate your API key in the NEAR AI Cloud Dashboard.Request IDs
Gateway responses fromhttps://cloud-api.near.ai/v1 include an X-Request-Id response header. Support may ask you for this value when debugging a request.
X-Request-Id is opaque support/debugging metadata; it is not W3C traceparent or distributed trace context. If you send your own X-Request-Id, use a non-sensitive UUID value. X-Request-Id values must not contain secrets or PII. X-Org-Id and X-Workspace-Id are internal tenant headers; public clients cannot set or override them.
Usage Examples
- Python
- JavaScript/TypeScript
Supported Features
NEAR AI Cloud supports the following core OpenAI API features:- Chat Completions (
/v1/chat/completions) - Including tool calling, structured outputs, and reasoning - Completions (
/v1/completions) - Legacy text completions - Models List (
/v1/models) - Embeddings (
/v1/embeddings) - See Beyond Chat - Images (
/v1/images/generations,/v1/images/edits) - See Beyond Chat - Audio Transcription (
/v1/audio/transcriptions) - See Beyond Chat - Responses (
/v1/responses) - Stateless,store: falseinference with client-managed history and custom functions; see Stateless Responses - Streaming (Server-Sent Events)
- Reranking (
/v1/rerank) - Score documents against a query - Privacy classification (
/v1/privacy/classify) - Detect personally identifiable information through the gateway - Privacy redaction (
/v1/privacy/redact) - Gateway-only endpoint for redacting personally identifiable information - Attestation & Signatures (
/v1/attestation/report,/v1/signature/{chat_id}) - See Verification
Stateless Responses
The Responses API preserves the OpenAI Responses input, output, and streaming shapes without storing conversation or response history. Setstore: false or omit it, and include any prior context in each new request.
- Python
- JavaScript/TypeScript