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
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. The example below demonstrates a simple chat completion request to the DeepSeek model running in a secure TEE environment.
Replace YOUR_API_KEY with the API key you generated in the setup steps above.
- curl
- Python
- JavaScript
curl https://cloud-api.near.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "deepseek-ai/DeepSeek-V3.1",
"messages": [{
"role": "user",
"content": "Hello, NEAR AI!"
}]
}'
import openai
client = openai.OpenAI(
base_url="https://cloud-api.near.ai/v1",
api_key="YOUR_API_KEY"
)
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V3.1",
messages=[{
"role": "user", "content": "Hello, NEAR AI!"
}]
)
print(response.choices[0].message.content)
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: 'deepseek-ai/DeepSeek-V3.1',
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": "chatcmpl-d17ba5d9f393440591562f4ff006f246",
"object": "chat.completion",
"created": 1762892406,
"model": "deepseek-ai/DeepSeek-V3.1",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello there! 👋 Welcome to the NEAR ecosystem! \n\nHow can I assist you today? Whether you're looking to build on NEAR, explore dApps, set up a wallet, or learn about the protocol, I'm here to help! Just let me know what you need. 😊"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 13,
"total_tokens": 75,
"completion_tokens": 62
}
}
All inference is performed within Trusted Execution Environments (TEEs), ensuring your data remains private and verifiable.
For advanced features like streaming, async operations, Files API, and Conversations API, see our comprehensive OpenAI Compatibility Guide.
Next Steps
Explore Models
Browse available AI models including DeepSeek, Llama, OpenAI, and Qwen
Private Inference
Learn about the secure architecture and how your data is protected
Verification
Understand how to verify and validate secure interactions with AI models
OpenAI Compatibility
Use standard OpenAI SDKs with streaming, async, Files API, and more