NEAR AI Cloud: Quickstart
NEAR AI Cloud offers developers access to secure, private, verifiable AI models through a unified API. This quickstart guide will walk you through creating an account and making your first requests in minutes.
Setup
- Create your account - Sign up at cloud.near.ai
- Add Credits - Go to the "Credits" section and purchase credits based on your needs
- Generate API Key - Go to the "API Keys" section and generate a new key
[!TIP]
Keep Your API Key Safe
Never share your API key publicly or commit it to version control. If compromised, you can regenerate it anytime from your dashboard.
Make Your First API Call
NEAR AI Cloud uses an OpenAI-compatible API, making it easy to integrate with existing tools and libraries. Connect through the NEAR AI Cloud Gateway at cloud-api.near.ai.
[!NOTE]
Replace
YOUR_API_KEYwith the API key you generated in the setup steps above.
[!TIP]
Request IDs
Gateway responses include an
X-Request-Idresponse header. Support may ask you for it when debugging a request. The value is opaque support/debugging metadata, not W3Ctraceparentor distributed trace context. If you send your ownX-Request-Id, use a non-sensitive UUID value;X-Request-Idvalues must not contain secrets or PII.X-Org-IdandX-Workspace-Idare internal tenant headers; public clients cannot set or override them.
The gateway routes your request to the appropriate model TEE:
curl
curl https://cloud-api.near.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "zai-org/GLM-5.1-FP8",
"messages": [{
"role": "user",
"content": "Hello, NEAR AI!"
}]
}'
Python
import openai
client = openai.OpenAI(
base_url="https://cloud-api.near.ai/v1",
api_key="YOUR_API_KEY"
)
response = client.chat.completions.create(
model="zai-org/GLM-5.1-FP8",
messages=[{
"role": "user", "content": "Hello, NEAR AI!"
}]
)
print(response.choices[0].message.content)
JavaScript
import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: 'https://cloud-api.near.ai/v1',
apiKey: 'YOUR_API_KEY',
});
const completion = await openai.chat.completions.create({
model: 'zai-org/GLM-5.1-FP8',
messages: [{
role: 'user', content: 'Hello, NEAR AI!'
}]
});
console.log(completion.choices[0].message.content);
Expected Response
The API will return a JSON response containing the model's completion:
{
"id": "f47b4647911249f7a94468f6c2b95832",
"object": "chat.completion",
"created": 1780405025,
"model": "zai-org/GLM-5.1-FP8",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello there! 👋 Welcome to NEAR AI! I'm here to help you with whatever you need — whether it's answering questions, brainstorming ideas, writing code, or just having a conversation. How can I assist you today?",
"reasoning_content": "The user is greeting me. I should respond warmly and introduce myself as a NEAR AI assistant."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 11,
"completion_tokens": 70,
"completion_tokens_details": {
"reasoning_tokens": 21
},
"reasoning_tokens": 21,
"total_tokens": 81
}
}
[!NOTE]
zai-org/GLM-5.1-FP8is a reasoning model, so the response includes areasoning_contentfield and the reasoning token count inusage.completion_tokens_details.reasoning_tokens(the top-levelreasoning_tokensis a deprecated alias). See Reasoning Models to control this behavior.
All inference is performed within Trusted Execution Environments (TEEs), ensuring your data remains private and verifiable.
[!TIP]
Using OpenAI SDKs?
For streaming, async operations, and the stateless Responses API, see our comprehensive OpenAI Compatibility Guide.
Next Steps
Browse available AI models including GLM, Qwen, OpenAI, Anthropic, and Gemini
Learn about the secure architecture and how your data is protected
Understand how to verify and validate secure interactions with AI models
Use standard OpenAI SDKs with streaming, async, and stateless Responses