Ashna AI Agent Platform API
Build powerful AI agents on top of multiple language models. Access GPT, Gemini, and custom models through a unified API. Create, configure, and deploy AI agents in minutes.
Base URL
https://api.ashna.ai/v1/apiPlatform Overview
Ashna AI provides an agent-based architecture that allows you to:
- Select from multiple AI models (GPT-4, GPT-3.5, Gemini Pro, Gemini Flash)
- Create custom agents with specific instructions and behaviors
- Attach tools and capabilities to agents for specialized tasks
- Configure memory and context management for conversations
- Stream responses in real-time for better UX
Quickstart
Get started with the Ashna AI API in under 5 minutes.
1. Get Your API Key
Sign up at app.ashna.ai/api-dashboard/overview and generate your API key from the dashboard.
2. Make Your First Request
▸ curl https://api.ashna.ai/v1/api/chat \▸ -H "Authorization: Bearer YOUR_API_KEY" \▸ -H "Content-Type: application/json" \▸ -d '{▸ "model": "agent_abc123",▸ "message": "Hello, can you help me?"▸ }'Authentication
All API requests require authentication using an API key passed in the Authorization header.
Headers
AuthorizationstringBearer token with your API key. Format: Bearer YOUR_API_KEY
Content-TypestringShould be set to application/json
▸ curl https://api.ashna.ai/v1/api/chat \▸ -H "Authorization: Bearer sk_live_abc123..." \▸ -H "Content-Type: application/json"Errors
The API uses standard HTTP response codes. Error responses include a JSON body with details.
400Invalid request parameters or malformed JSON
401Missing or invalid API key
404Resource does not exist
429Too many requests in a given time period
500Something went wrong on our end
Error Response Format
{ "error": { "type": "invalid_request", "message": "Agent ID is required", "code": "missing_parameter" }}Webhooks & Events
COMING SOON
Configure webhooks to receive real-time notifications when events occur in your agents.
Supported Events
agent.created- New agent createdagent.execution.started- Agent execution beganagent.execution.completed- Agent execution finishedtool.invoked- Tool was called by agent
{ "event": "agent.execution.completed", "timestamp": "2026-01-04T10: 30: 00Z", "data": { "agent_id": "agent_abc123", "execution_id": "exec_xyz789", "status": "success", "duration_ms": 1450 }}API Endpoints
Ashna AI provides multiple endpoints for different use cases, from high-level chat interfaces to low-level completion APIs.
Chat API
The high-level, stateful chat endpoint designed for UI-based conversations. This endpoint manages conversation state, injects bot configurations, and handles streaming responses.
Endpoint
/v1/api/chatKey Parameters
chatIdstringUnique identifier for the conversation. Used to maintain state across multiple messages.
messagesUIMessage[]Array of UIMessage objects representing the conversation history.
modelstringModel identifier (e.g., "ashnaai", "gemini-pro").
streambooleanEnable streaming responses for real-time output.
streamTypetext | dataStream format: "text" for simple text streaming, "data" for structured event streaming.
temperaturenumberControls randomness (0.0-2.0). Lower values are more deterministic.
maxTokensnumberMaximum number of tokens to generate in the response.
Request Example
▸ curl https://api.ashna.ai/v1/api/chat \▸ -H "Authorization: Bearer YOUR_API_KEY" \▸ -H "Content-Type: application/json" \▸ -d '{▸ "chatId": "chat_abc123",▸ "messages": [▸ {▸ "id": "msg_1",▸ "role": "user",▸ "parts": [▸ {▸ "type": "text",▸ "text": "What is machine learning?"▸ }▸ ]▸ }▸ ],▸ "model": "ashnaai",▸ "temperature": 0.7,▸ "maxTokens": 500,▸ "stream": true,▸ "streamType": "data"▸ }'Response Example
{ "id": "msg_2", "role": "assistant", "parts": [ { "type": "text", "text": "Machine learning is a subset of artificial intelligence..." } ], "metadata": { "model": "ashnaai", "tokensUsed": 245, "finishReason": "stop" }}Chat Completions
OpenAI-compatible, stateless chat completion endpoint. Ideal for developers and SDK usage with role-based messages.
Endpoint
/v1/api/chat/completionsKey Parameters
messagesarrayArray of message objects with "role" (system, user, assistant) and "content".
modelstringModel identifier (e.g., "ashnaai", "gemini-pro").
temperaturenumberSampling temperature between 0 and 2.
Request Example
▸ curl https://api.ashna.ai/v1/api/chat/completions \▸ -H "Authorization: Bearer YOUR_API_KEY" \▸ -H "Content-Type: application/json" \▸ -d '{▸ "model": "ashnaai",▸ "messages": [▸ {▸ "role": "system",▸ "content": "You are a helpful assistant."▸ },▸ {▸ "role": "user",▸ "content": "Explain quantum computing"▸ }▸ ],▸ "temperature": 0.7,▸ "max_tokens": 500▸ }'Response Example
{ "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1704369000, "model": "ashnaai", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Quantum computing leverages quantum mechanics..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 25, "completion_tokens": 245, "total_tokens": 270 }}Text Completions
Legacy single-prompt text completion endpoint. Included for backward compatibility with simple one-shot text generation use cases.
Endpoint
/v1/api/completionsKey Parameters
promptstringThe text prompt to generate completion for.
modelstringModel identifier (e.g., "ashnaai").
Request Example
▸ curl https://api.ashna.ai/v1/api/completions \▸ -H "Authorization: Bearer YOUR_API_KEY" \▸ -H "Content-Type: application/json" \▸ -d '{▸ "model": "ashnaai",▸ "prompt": "Explain quantum computing in simple terms",▸ "max_tokens": 500,▸ "temperature": 0.7▸ }'Response Example
{ "id": "cmpl-abc123", "object": "text_completion", "created": 1704369000, "model": "ashnaai", "choices": [ { "text": "Quantum computing is a revolutionary approach...", "index": 0, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 245, "total_tokens": 257 }}Streaming Responses
Stream responses in real-time for better user experience.
▸ curl https://api.ashna.ai/v1/api/chat \▸ -H "Authorization: Bearer YOUR_API_KEY" \▸ -H "Content-Type: application/json" \▸ -d '{▸ "message": "Write a story about AI",▸ "stream": true▸ }'Stream Event Format
data: {"type": "content", "delta": "Once upon"}data: {"type": "content", "delta": " a time"}data: {"type": "content", "delta": " there was"}data: {"type": "done", "execution_id": "exec_123"}SDKs & Integrations
Official SDKs and integrations for popular platforms.
Python SDK
from openai import OpenAI # Simply change the base URLclient= OpenAI( api_key="YOUR_ASHNA_API_KEY", base_url="https://api.ashna.ai/v1/api") # Use standard OpenAI coderesponse= client.chat.completions.create( model="ashnaai", messages=[ {"role": "user", "content": "Hello!"} ])JavaScript/TypeScript SDK
import OpenAI from 'openai'; // Simply change the base URLconst client = new OpenAI({ apiKey: 'YOUR_ASHNA_API_KEY', baseURL: 'https://api.ashna.ai/v1/api'//api.ashna.ai/v1/api'}); // Use standard OpenAI codeconst response = await client.chat.completions.create({ model: 'ashnaai', messages: [ { role: 'user', content: 'Hello!' } ]});