Integrating Uncensored API with Local Agents
Developers often build local agents to handle specific tasks without cloud latency. This guide shows how to connect those agents to our uncensored API for flexible text generation. You will learn to configure endpoints, manage tokens, and handle errors effectively.

Understanding the Endpoint Structure
The foundation of any integration is the base URL and the specific endpoint paths. Our API provides a hosted service that mimics the standard OpenAI chat completions interface. This design allows you to use familiar SDKs without writing custom HTTP clients from scratch. The base URL for all requests is https://api.uncensoredstory.cc/v1. You will primarily interact with the POST /v1/chat/completions endpoint for generating text responses. This endpoint accepts text input and returns text output, making it ideal for agent workflows that require natural language processing. Additionally, the POST /v1/responses endpoint offers an alternative response format for developers who prefer a different structure. For checking available models, you can use the GET /v1/models endpoint. It is important to note that this service focuses solely on text generation. It does not support embeddings, image generation, audio processing, or video creation. If your agent requires multimodal capabilities, you may need to combine this API with other specialized tools. The model identifier you must send in your requests is simply "uncensored". This ensures that the model processes your input without the typical refusals found in other models. By sticking to these endpoints, you ensure that your agent communicates correctly with the service. The simplicity of the text-in, text-out model reduces the complexity of your integration code. You do not need to handle complex file uploads or binary data streams. This makes the API particularly suitable for agents that process text data, such as code generators or creative writing assistants. The focus on text allows for faster response times and lower latency in your automation scripts.Configuring SDK Settings for Reliability
When integrating with an API, proper configuration of the SDK is important for maintaining reliability. Our API supports standard parameters that you can adjust to fine-tune the model's behavior. You can set the temperature to control creativity, use top_p for nucleus sampling, and define stop sequences to halt generation at specific points. The seed parameter allows you to reproduce specific outputs, which is useful for testing and debugging. Additionally, you can use penalties to discourage repetitive or unwanted tokens. These parameters give you granular control over the output quality. Streaming over Server-Sent Events (SSE) is another key feature. This allows your agent to receive tokens as they are generated, providing a more responsive user experience. The usage information is included in the last chunk of the stream, so you can track token consumption in real-time. Function calling is also supported, enabling your agent to interact with external tools or APIs. This is particularly useful for agents that need to perform actions based on the model's decisions. JSON mode ensures that the output is strictly valid JSON, which simplifies parsing in your code. By configuring these settings correctly, you can ensure that your agent behaves predictably. It is important to test different parameter combinations to find the optimal balance between creativity and accuracy. The API's flexibility allows you to tailor the model's behavior to your specific use case. If you are building a chatbot or a code generator, these settings provide the tools you need to create a reliable integration.Managing Tokens and Budgeting Costs
Understanding token usage is essential for managing costs effectively. Our API charges $0.15 per million input tokens and $0.50 per million output tokens. This pricing model is straightforward and predictable. You pay only for the tokens actually used, with no monthly subscription fees. Prepaid credit is charged based on real token usage, and errors or refusals are free. This means you do not waste credit on failed requests. The context window supports up to 100,000 tokens, allowing for long conversations or large documents. To estimate costs, you can use the formula: (tokens divided by 1,000,000) times the per-million price. For example, if your agent processes 10,000 input tokens and 5,000 output tokens, the cost would be calculated based on these counts. It is important to monitor your token usage to avoid unexpected charges. You can top up your account with crypto, specifically USDT on TRC20 or USDC on Base. The minimum top-up amount is $20, and the maximum is $500. You can also receive bonus credit when you top up $50 or more. Paid credit never expires, so you can use it at your own pace. This flexibility is beneficial for developers who work on projects intermittently. By keeping track of your token usage, you can optimize your agent's performance and minimize costs. The absence of a monthly fee means you only pay for what you use, making it a cost-effective solution for indie builders.Handling Errors and Rate Limits
Errors and rate limits are common challenges in API integration. Our API returns specific HTTP status codes to help you diagnose issues. A 401 error indicates an invalid key, so you should verify your authentication credentials. A 402 error means you have no credit left, which requires you to top up your account. A 429 error signifies that you have exceeded the rate limit of 300 requests per minute per key. To handle these errors gracefully, you should implement retry logic in your agent. For rate limits, consider implementing a backoff strategy to avoid overwhelming the API. It is also important to check your key validity before making requests. The API does not charge for errors or refusals, so you do not lose credit for failed attempts. This feature is particularly useful for testing and debugging. By handling errors effectively, you can ensure that your agent continues to function even when issues arise. It is also advisable to log error messages for later analysis. This can help you identify patterns and optimize your integration. The rate limit of 300 requests per minute is generous for most use cases, but it is important to be aware of it. If your agent makes too many requests, you may need to throttle them. Implementing a queue system can help manage the flow of requests. This ensures that your agent does not exceed the rate limit. By anticipating these challenges, you can create a more reliable and reliable integration.When This API Is Not the Right Choice
While our API is powerful for text generation, it may not be the right choice for every project. If your agent requires image, audio, or video generation, this service will not meet your needs. The API focuses solely on text, so you will need to integrate with other tools for multimodal capabilities. Similarly, if you need embeddings for vector search, this API does not provide that feature. You would need to use a separate embedding service. Fine-tuning is also not supported, so you cannot train the model on your specific dataset. If your project requires on-premises deployment for data privacy, this hosted service may not fit your requirements. Additionally, if you need model routing to switch between different models, this API serves only one uncensored model. Developers looking for a comprehensive suite of AI tools may find this service limited. However, for pure text generation, it offers a reliable and flexible solution. It is important to assess your project's needs before integrating. If your agent primarily processes text and does not require advanced features like embeddings or fine-tuning, this API is an excellent choice. The simplicity of the text-in, text-out model makes it easy to integrate. You can focus on building your agent's logic without worrying about complex multimodal workflows. By understanding the limitations, you can make an informed decision about whether this API fits your project.Addressing Community Questions on Reddit
Reddit threads often discuss the challenges of integrating local LLM APIs with automation tools. Users on r/LocalLLM frequently ask about validating local API specs and ensuring that tools like LMStudio or Ollama work correctly. They seek advice on setting up reliable architectures for chat automation using Playwright. Another common topic is the choice of hardware, such as whether a single 3090 GPU is sufficient for running local models. Developers also inquire about using CLI agents to roast technical debt or automating web-based chat jobs. These discussions highlight the need for reliable and flexible API integrations. Our API addresses these needs by providing a straightforward OpenAI-compatible endpoint. This allows developers to easily connect their local agents to a cloud-based model. The support for streaming and function calling enhances the functionality of local agents. By using our API, developers can offload the heavy lifting of model inference to a hosted service. This reduces the hardware requirements for local setups. The ability to top up with crypto and the absence of monthly fees make it an attractive option for indie builders. The community's focus on reliability and cost-effectiveness aligns with our API's features. By addressing these common pain points, we provide a valuable solution for developers looking to enhance their local agent workflows.Best Practices for Agent Integration
To ensure a smooth integration, follow these best practices. First, always verify your API key before making requests. This prevents 401 errors and wasted credits. Second, implement proper error handling to manage 402 and 429 errors gracefully. Use retry logic with exponential backoff to handle rate limits. Third, monitor your token usage to stay within your budget. Use the token counting formula to estimate costs. Fourth, utilize the streaming feature for a better user experience. This allows your agent to display responses in real-time. Fifth, test your integration with different parameters to find the optimal configuration. Use the seed parameter for reproducibility. Sixth, consider using function calling to extend your agent's capabilities. This allows it to interact with external tools. Seventh, keep your SDK updated to benefit from the latest features. Eighth, log errors and usage data for analysis. This helps you optimize your integration over time. By following these practices, you can create a reliable and efficient agent. The API's simplicity and flexibility make it a great choice for developers. If you are building a chatbot, a code generator, or a creative writing assistant, this API provides the tools you need. The focus on text generation ensures that your agent can handle a wide variety of tasks. By integrating effectively, you can open up the full potential of the uncensored model.Frequently asked questions
How do I top up my account?
You can top up your account with USDT on TRC20 or USDC on Base. The minimum amount is $20 and the maximum is $500. You can also receive bonus credit when you top up $50 or more.
What happens if I run out of credit?
If you run out of credit, you will receive a 402 error. You can top up your account with crypto to continue using the API. Errors and refusals do not consume credit.
Can I use this API for image generation?
No, this API is for text generation only. It does not support image, audio, or video generation. You would need to use a separate service for multimodal capabilities.
Is there a monthly subscription fee?
No, there is no monthly subscription fee. You pay only for the tokens you use. Paid credit never expires, so you can use it at your own pace.