EN ▾
Get API key

Integrate an Embedding API into Your Python or Node App

Developers often struggle to find reliable text-only APIs that fit specific budget constraints. This guide walks you through integrating a simple, uncensored text API into Python or Node.js applications using standard HTTP clients.

Developer workspace with laptop and network nodes illustrating API integration

Understanding the API Structure

Integrating a text-based API requires understanding its core endpoints. Our service provides a hosted, OpenAI-compatible chat-completions API that serves a single uncensored open-weight text model. The model identifier you must send is simply uncensored. This simplicity means you do not need to manage multiple model versions or routing logic. The base URL for all requests is https://api.embeddingapis.com/v1. You will interact with three main endpoints: POST /v1/chat/completions for generating text, POST /v1/responses for standardized response formats, and GET /v1/models to verify available models.

It is important to note that this service is text-in, text-out. It does not support embeddings, image generation, audio processing, or video creation. There is no OCR capability, no fine-tuning options, and no model routing features. If your project requires vector embeddings or multimodal inputs, this API is not the right choice. You should look for a dedicated embedding provider for those specific needs. However, for pure text generation tasks, this API offers a straightforward and direct interface.

The context window for this model is 100,000 tokens, covering both the prompt and the completion together. This large window allows for extensive context handling in a single request. You can send long documents or maintain long conversation histories without needing to chunk data excessively. The uncensored nature of the model means it does not refuse lawful adult, fictional, security-research, or controversial topics. This makes it suitable for creative writing, role-playing, or research applications where strict content filters might interfere with the output.

When integrating, you will use standard HTTP methods. The API accepts JSON payloads and returns JSON responses. You can enable streaming over Server-Sent Events (SSE) to receive usage data in the last chunk. This is useful for real-time applications where you want to display progress or usage statistics as the model generates text. The API also supports function calling, JSON mode, and various parameters like temperature, top_p, stop sequences, and seed values. These features allow you to control the randomness and format of the output precisely.

Setting Up Authentication and Keys

Authentication is handled through API keys that you generate upon signup. You can create an account by continuing with Google or using an email and password combination. Once you sign up, your API key is shown immediately, allowing you to start making requests without delay. This key is unique to your account and should be kept secure. You can use this key to authenticate your requests by including it in the Authorization header.

The API enforces a rate limit of 300 requests per minute per key. This limit is designed to prevent abuse and ensure fair usage across the platform. If you exceed this limit, you will receive a 429 rate limit error. It is important to implement retry logic in your application to handle these errors gracefully. You should also monitor your usage to ensure you do not accidentally hit the rate limit during high-traffic periods.

Errors are handled with specific HTTP status codes. A 401 error indicates an invalid key, which means you need to check your authentication credentials. A 402 error indicates that you have no credit remaining on your account. In this case, you will need to top up your balance before making further requests. A 429 error indicates that you have exceeded the rate limit. These errors are free of charge, meaning you are not billed for failed requests or rate limit errors.

To manage your account, you can view your current balance and usage statistics through the dashboard. The API does not require a subscription or monthly fee. Instead, you pay only for the tokens you use. This pay-as-you-go model is ideal for developers who want to avoid recurring costs. You can top up your balance using cryptocurrency, specifically USDT on the TRC20 network or USDC on the Base network. The minimum top-up amount is $20, and the maximum is $500. Bonus credit is available for top-ups of $50 or more, ranging from +5% to +15%.

Integrating with Python Clients

Integrating the API into a Python application is straightforward using the requests library or the official OpenAI Python client. Since the API is OpenAI-compatible, you can use the same code structure you are familiar with. You need to set the base URL to https://api.embeddingapis.com/v1 and provide your API key in the authorization header. This allows you to use existing libraries without significant modifications.

When making requests, you can specify the model as uncensored and include your prompt in the messages array. You can also set parameters like temperature, top_p, and stop sequences to control the output. For example, setting the temperature to 0.7 provides a balance between creativity and coherence. You can also enable JSON mode to force the model to output valid JSON, which is useful for structured data extraction.

Streaming responses are supported via Server-Sent Events (SSE). This allows you to receive tokens as they are generated, which is useful for real-time applications. You can process the streaming data to display progress or usage statistics. The usage information is included in the last chunk of the stream, so you can calculate the total tokens used for billing purposes.

It is important to handle errors appropriately in your Python code. You should check for 401, 402, and 429 errors and respond accordingly. For example, if you receive a 402 error, you might prompt the user to top up their balance. If you receive a 429 error, you should implement a retry mechanism with exponential backoff. This ensures that your application remains reliable and reliable even under high load.

Integrating with Node.js Clients

Integrating the API into a Node.js application is equally simple using the fetch API or the axios library. You can send POST requests to the /v1/chat/completions endpoint with your API key in the authorization header. The request body should include the model identifier, messages, and any additional parameters you wish to use. This approach allows you to use the vast ecosystem of Node.js libraries for HTTP requests.

For streaming responses, you can use the ReadableStream API in Node.js. This allows you to process the response data chunk by chunk as it arrives. This is particularly useful for applications that require real-time updates, such as chatbots or live dashboards. You can parse the streaming data to extract tokens and display them to the user.

JSON mode is a powerful feature that allows you to force the model to output valid JSON. This is useful for extracting structured data from unstructured text. You can set the response_format parameter to {type: 'json_object'} to enable this feature. The model will then output data that conforms to the specified schema, making it easier to parse and use in your application.

Error handling in Node.js should be done using try-catch blocks. You should check for HTTP errors and handle them appropriately. For example, if you receive a 401 error, you might log the error and prompt the user to check their API key. If you receive a 402 error, you might display a message indicating that the account has no credit. If you receive a 429 error, you should implement a retry mechanism to handle rate limiting.

Handling Costs and Billing

Understanding the cost structure is essential for budgeting your API usage. The API charges $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. This pricing model is transparent and allows you to estimate costs based on token usage. You can calculate the cost of a request by dividing the number of tokens by 1,000,000 and multiplying by the respective price.

Prepaid credit is charged based on real token usage. Errors and refusals are free, meaning you are not billed for failed requests or rate limit errors. This is beneficial for testing and development, as you can make numerous requests without incurring significant costs. Paid credit never expires, so you can top up your balance whenever you need to.

To top up your balance, you can use cryptocurrency. The accepted currencies are USDT on the TRC20 network and USDC on the Base network. You can top up with any whole amount between $20 and $500. Bonus credit is available for top-ups of $50 or more, ranging from +5% to +15%. This bonus credit can help you get more value for your money.

It is important to monitor your usage to avoid unexpected charges. You can view your current balance and usage statistics through the dashboard. If you notice unusual activity, you can investigate the cause and adjust your usage accordingly. The API does not require a subscription or monthly fee, so you only pay for what you use. This makes it a cost-effective solution for developers who want to avoid recurring costs.

When This API Is Not the Right Choice

While this API is excellent for text generation, it is not suitable for all use cases. If your project requires vector embeddings, this API is not the right choice. The service does not offer embedding capabilities, so you will need to use a dedicated embedding provider for those tasks. Similarly, if you need image, audio, or video generation, this API cannot fulfill those needs.

The API also does not support OCR, fine-tuning, or model routing. If your application requires these features, you should look for a more comprehensive solution. Additionally, the API is text-in, text-out, meaning it does not handle multimodal inputs. If you need to process images or audio along with text, this API may not be the best fit.

Another limitation is the lack of an official SLA or certifications like SOC2 or HIPAA. If your project requires strict compliance with these standards, you should consider other providers. The API also does not offer on-prem deployment options, so you will need to rely on the hosted service. If you need to deploy the model on your own infrastructure, this API may not meet your needs.

Finally, the API does not offer a free unlimited tier. While new accounts receive $0.50 of trial credit, you will need to top up your balance to continue using the service. If you are looking for a completely free solution, this API may not be the best option. However, for developers who need a reliable, uncensored text API with flexible pricing, this service is an excellent choice.

Addressing Common Developer Questions

Developers often ask about the performance and reliability of embedding APIs. In discussions on Reddit, users have shared their experiences with various embedding providers. Some developers have noted that certain frameworks optimize for convenience in demos rather than transparency in production. This can lead to issues when scaling up applications. It is important to choose a provider that offers stable and predictable performance.

Another common question is about the cost of embedding APIs. Users have discussed how to save on embedding API bills by identifying redundant calls. Some developers have built tools to analyze their usage and identify opportunities for optimization. This can help reduce costs and improve efficiency. It is advisable to monitor your usage regularly to ensure you are getting the best value for your money.

Developers also inquire about the ease of integration. Many users appreciate the simplicity of OpenAI-compatible APIs, as they can use existing libraries and code structures. This reduces the learning curve and allows for faster development. It is important to choose an API that integrates smoothly with your existing tech stack.

Finally, users often ask about the uncensored nature of the model. Some developers are looking for models that do not refuse lawful adult or controversial topics. This is particularly useful for creative writing, role-playing, and research applications. It is important to ensure that the model meets your specific content requirements. This API offers an uncensored model that can handle a wide range of topics without strict filters.

Frequently asked questions

How do I top up my balance?

You can top up your balance using USDT on the TRC20 network or USDC on the Base network. The minimum amount is $20, and the maximum is $500. Bonus credit is available for top-ups of $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 balance using cryptocurrency to continue using the API. Errors and refusals are free, so you are not billed for failed requests.

Does the API support streaming?

Yes, the API supports streaming over Server-Sent Events (SSE). You can receive usage data in the last chunk of the stream. This is useful for real-time applications where you want to display progress or usage statistics.

Is the API suitable for embedding tasks?

No, this API is text-in, text-out and does not support embeddings. If you need vector embeddings, you should use a dedicated embedding provider. This API is best for pure text generation tasks.