Introduction

The Nyata AI API allows you to integrate our Bristol AI characters into your applications. Purchase an API key to get started with authentic conversational AI.

Base URL

All API requests should be made to the following base URL:

https://ai.mottatracking.com/chat_api.php

The API uses standard HTTP response codes to indicate the success or failure of requests. Generally, codes in the 2xx range indicate success, codes in the 4xx range indicate an error in the request parameters, and codes in the 5xx range indicate a server error.

Authentication

To access the Nyata AI API, you need to purchase an API key. You can obtain an API key by creating an account and purchasing a plan.

API Key Authentication

Include your purchased API key in the X-API-Key header of all requests:

X-API-Key: nyata_your_api_key_here

Keep your API key secure. Do not share it publicly, include it in client-side code, or commit it to version control systems.

Don't have an API key yet? Purchase one here

Rate Limits

API rate limits are based on your purchased plan. Each plan includes a specific number of requests.

Request Limits by Plan

Plan Requests Included Duration Price
Free Trial 100 requests 7 days £0
Basic 1,000 requests 30 days £10
Premium 10,000 requests 30 days £50
Enterprise 100,000 requests 30 days £200

When you reach your request limit, the API will return a 403 Forbidden response with details about your usage.

Chat API

Send messages to our Bristol AI characters and receive intelligent, context-aware responses.

POST https://ai.mottatracking.com/chat_api.php

Send Chat Message

Send a message to the AI and receive a response. The AI uses your conversation history to provide contextual replies.

Headers

Header Value Description
Content-Type application/json (required) Must be set to application/json
X-API-Key string (required) Your purchased API key (format: nyata_xxxxx)

Request Body

{ "model": "gpt-4-turbo", "messages": [ { "role": "user", "content": "Can you recommend affordable food places in Stokes Croft?" } ], "max_tokens": 150, "temperature": 0.7 }
Parameter Type Description
model string (required) The AI model to use (e.g., "gpt-4-turbo", "gpt-3.5-turbo")
messages array (required) Array of message objects with role and content
max_tokens integer (optional) Maximum number of tokens in the response (default: 150)
temperature float (optional) Controls randomness (0.0-1.0, default: 0.7)

Response

200: Success
403: Forbidden
401: Unauthorized
{ "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1704067200, "model": "gpt-4-turbo", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Alright me lover! For affordable grub in Stokes Croft, you can't go wrong with Pieminister on North Street - proper lush pies, they are. Also check out The Canteen on Stokes Croft itself, good value and supports local. If you fancy something different, try Thali Cafe on Cheltenham Road - brilliant curries and really reasonable prices." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 25, "completion_tokens": 78, "total_tokens": 103 }, "api_usage": { "requests_remaining": 942, "plan_type": "basic" } }
{ "error": { "code": "quota_exceeded", "message": "API request limit exceeded. Please upgrade your plan or wait for quota reset.", "status": 403, "details": { "requests_used": 1000, "requests_limit": 1000, "plan_type": "basic" } } }
{ "error": { "code": "invalid_api_key", "message": "Invalid API key provided. Please check your key and try again.", "status": 401 } }

Available Characters

Our API provides access to multiple AI characters, each with unique Bristol personalities and expertise.

Character Profiles

Character Personality Expertise
Brenda (Female) Friendly, empathetic, local guide Bristol venues, food, events, social recommendations
Dave (Male) Knowledgeable, straightforward, helpful General queries, practical advice, local knowledge
Miss Thompson (Teacher) Patient, educational, encouraging Learning, tutoring, explanations
Coach Marcus (Gym Trainer) Motivating, energetic, supportive Fitness, nutrition, health advice
Jamie (Child-Friendly) Fun, safe, age-appropriate Educational content, games, stories for children

All characters have authentic Bristol accents and deep knowledge of local areas, venues, and culture. They automatically adapt their responses based on context.

Usage Tracking

Monitor your API usage and remaining requests through response headers and your dashboard.

Usage Information

Every successful API response includes usage information:

"api_usage": { "requests_remaining": 942, "plan_type": "basic", "expires_at": "2025-05-01T23:59:59Z" }

You can also view detailed usage statistics in your API Dashboard.

Client SDKs

We provide example code in multiple programming languages to help you get started quickly.

Code Examples

JavaScript
Python
PHP
cURL
// JavaScript Example const API_KEY = 'nyata_your_api_key_here'; const API_URL = 'https://ai.mottatracking.com/chat_api.php'; async function chatWithBristolAI(message) { try { const response = await fetch(API_URL, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': API_KEY }, body: JSON.stringify({ model: 'gpt-4-turbo', messages: [ { role: 'user', content: message } ], max_tokens: 150, temperature: 0.7 }) }); const data = await response.json(); if (data.api_usage) { console.log(`Requests remaining: ${data.api_usage.requests_remaining}`); } return data.choices[0].message.content; } catch (error) { console.error('Error:', error); } } // Example usage chatWithBristolAI('Where can I find good coffee in Clifton?') .then(reply => console.log(reply));
# Python Example import requests API_KEY = 'nyata_your_api_key_here' API_URL = 'https://ai.mottatracking.com/chat_api.php' def chat_with_bristol_ai(message): headers = { 'Content-Type': 'application/json', 'X-API-Key': API_KEY } payload = { 'model': 'gpt-4-turbo', 'messages': [ {'role': 'user', 'content': message} ], 'max_tokens': 150, 'temperature': 0.7 } try: response = requests.post(API_URL, headers=headers, json=payload) data = response.json() if 'api_usage' in data: print(f"Requests remaining: {data['api_usage']['requests_remaining']}") return data['choices'][0]['message']['content'] except Exception as e: print(f"Error: {e}") return None # Example usage reply = chat_with_bristol_ai('Where can I find good coffee in Clifton?') print(reply)
// PHP Example As of my last update, Clifton could refer to various locations around the world, including Clifton in Bristol, UK, or Clifton in New Jersey, USA. Each has its unique coffee shop offerings. Here’s a general guide on how you might find good coffee in any area named Clifton: 1. **Online Reviews:** Websites like Yelp, TripAdvisor, and Google Maps are great for reading current reviews and ratings of coffee shops. Users often discuss the quality of the coffee, the ambiance of the shop, and the level of customer service. 2. **Local Recommendations:** Don't underestimate the value of local knowledge. Ask residents or local workers where they go for the best coffee. They can provide insights that aren’t always available online. 3
# cURL Example curl -X POST "https://ai.mottatracking.com/chat_api.php" \ -H "Content-Type: application/json" \ -H "X-API-Key: nyata_your_api_key_here" \ -d '{ "model": "gpt-4-turbo", "messages": [ { "role": "user", "content": "Where can I find good coffee in Clifton?" } ], "max_tokens": 150, "temperature": 0.7 }'

Support

Need help with integrating our API? We're here to help!

Getting Help

If you encounter any issues or have questions about our API, you can: