Integrating the Polish Text API: A Developer Checklist
Developers often search for reliable text-only APIs that handle specific language nuances without bloat. This guide walks you through the exact steps to connect to our service, from authentication to streaming responses, ensuring you get the most out of the integration.

Understanding the API Endpoint Structure
Before writing any code, it is essential to understand the base URL and the specific endpoints our service exposes. The base URL for all requests is https://api.polskillm.com/v1. This ensures that your client library knows exactly where to send HTTP traffic. Unlike some platforms that offer a complex suite of tools, our API focuses strictly on text generation. You will not find endpoints for image generation, audio processing, or video synthesis. This simplicity reduces the overhead of managing multiple service types and allows you to focus purely on text completion tasks.
The primary endpoint for generating text is POST /v1/chat/completions. This endpoint accepts a JSON payload containing the messages array, which defines the conversation history. Each message must have a role, such as system, user, or assistant, and content, which is the text string. The model identifier you must send is "uncensored". This tells the server which specific open-weight model to invoke for your request. Keeping this identifier consistent in your integration is important for reliable performance.
Another important endpoint is GET /v1/models. This allows you to verify the available models and their metadata. While our service currently serves only one uncensored open-weight text model, this endpoint provides a standard way to check model availability. It returns a list of models, each with an ID, object type, and creation timestamp. This is useful for debugging and ensuring your client is compatible with the current service version.
Finally, the POST /v1/responses endpoint offers an alternative way to interact with the model. It follows a similar structure to the chat completions endpoint but may offer different parsing behaviors for certain client libraries. Understanding the difference between these endpoints helps you choose the right tool for your specific use case. Whether you use chat completions or responses, the core authentication and token handling remain the same, ensuring a consistent developer experience across both methods.
Authentication and API Key Management
Authentication is the first step in any API integration. Our service uses API keys for authentication, which must be included in the Authorization header of every request. The header format is typically Authorization: Bearer YOUR_API_KEY. When you sign up, you can continue with Google or use an email and password. Upon creation, your API key is shown immediately, so you must copy it securely. This key is the only credential needed to access the service, and it grants you access to all endpoints and features.
It is critical to store your API key securely. Never expose it in client-side code or public repositories. If you suspect your key has been compromised, you can generate a new one from your dashboard. The key is tied to your account and controls your access to the service. Without a valid key, you will receive a 401 error, indicating that the key is invalid or missing. This error is a clear signal that your authentication credentials need to be updated or corrected.
Our service does not support multiple keys per account in the same way some competitors do. Each account has a single primary key that grants access. This simplifies key management but means you must be careful not to lose your key. If you lose your key, you may need to generate a new one, which could temporarily disrupt your service if not handled correctly. Always keep a backup of your key in a secure location, such as a environment variable or a secret manager.
When integrating with our API, ensure that your client library handles authentication headers correctly. Some libraries may require specific configuration to include the Bearer token. If you are using a custom HTTP client, make sure to set the header manually. Proper authentication ensures that your requests are processed correctly and that you are charged appropriately for your usage. It also helps in tracking usage and managing your prepaid credit effectively.
Handling Streaming Responses with SSE
One of the key features of our API is support for streaming responses over Server-Sent Events (SSE). This allows you to receive text chunks as they are generated, providing a smoother user experience compared to waiting for the entire response. To enable streaming, you must set the stream parameter to true in your request payload. The server will then send a series of data events, each containing a partial response.
Each SSE event contains a JSON object with a delta field, which holds the next part of the generated text. You need to parse these events and concatenate the deltas to form the complete response. This is particularly useful for chat applications where users expect real-time feedback. The streaming process continues until the server sends a done event, indicating that the response is complete. This approach reduces perceived latency and keeps users engaged.
It is important to handle SSE connections robustly. Network interruptions can cause the stream to drop, so you should implement reconnection logic in your client. If the connection is lost, you may need to restart the request or handle the partial response gracefully. The API provides usage information in the last chunk of the stream, which includes token counts. This allows you to track your consumption in real-time and adjust your budget accordingly.
When implementing streaming, ensure that your client can handle concurrent streams if you are making multiple requests. Each stream is independent, and you should manage them separately to avoid blocking the main thread. This is especially important in server-side applications where multiple users may be interacting with the API simultaneously. Proper stream management ensures that your application remains responsive and efficient.
Configuring Parameters and Controls
Our API supports several parameters that allow you to fine-tune the behavior of the model. The most common parameters include temperature, top_p, stop sequences, seed, and penalties. The temperature parameter controls the randomness of the output. A higher temperature results in more creative and varied responses, while a lower temperature produces more deterministic and focused outputs. Experimenting with different temperature values can help you find the right balance for your specific use case.
The top_p parameter controls the nucleus sampling, which limits the vocabulary to the most probable tokens. This helps in reducing the likelihood of generating nonsensical or low-probability words. The stop parameter allows you to specify a sequence of characters that will terminate the generation. This is useful for controlling the length of the response or stopping at specific markers. The seed parameter allows you to set a random seed for reproducible results, which is helpful for testing and debugging.
Penalties are another important feature, allowing you to adjust the frequency and presence of certain tokens. This can help in reducing repetition or encouraging the model to explore different topics. The API also supports JSON mode, which forces the output to be valid JSON. This is particularly useful for applications that require structured data output, such as extracting information from text or generating configuration files.
When configuring these parameters, it is important to test different combinations to see how they affect the output. Keep in mind that some parameters may interact in complex ways, so it is best to change one parameter at a time. This allows you to isolate the effect of each parameter and understand its impact on the model's behavior. Proper configuration ensures that you get the best possible results from the API.
Managing Credit and Pricing
Our API operates on a prepaid credit system, where you pay for actual token usage. The pricing is $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. Errors and refusals are free, which means you are only charged for successful generations. This model is cost-effective for developers who want to pay only for what they use. There is no monthly subscription fee, and your prepaid credit never expires, allowing you to use it at your own pace.
To add credit to your account, you can use crypto payments. We accept USDT on the TRC20 network or USDC on the Base network. The minimum top-up amount is $20, and the maximum is $500. If you top up with $50 or more, you receive a bonus credit ranging from 5% to 15%. This bonus can help you get more value from your purchases. Note that we do not accept credit cards, PayPal, or bank transfers, so you must have a crypto wallet to add funds.
It is important to monitor your credit balance regularly to avoid running out of funds during a request. If your balance is insufficient, you will receive a 402 error, indicating that you have no credit. In this case, you will need to top up your account before making further requests. The API provides a way to check your balance, so you can plan your usage accordingly. This helps in avoiding unexpected interruptions in your service.
When calculating costs, remember that the price is per million tokens. For small requests, the cost may be negligible, but for large-scale applications, it can add up quickly. Use the formula (tokens divided by 1,000,000 times the per-million price) to estimate your costs. This helps in budgeting and ensuring that you have enough credit for your expected usage. Proper financial planning ensures that your application runs smoothly without unexpected charges.
Rate Limits and Error Handling
Our API enforces a rate limit of 300 requests per minute per key. This limit is in place to ensure fair usage and maintain service stability. If you exceed this limit, you will receive a 429 error, indicating that you have hit the rate limit. In this case, you should wait for a short period before retrying your request. Implementing exponential backoff in your client can help manage rate limits effectively, preventing your application from being overwhelmed by too many simultaneous requests.
Error handling is important for a reliable integration. Besides the 429 rate limit error, you may encounter a 401 error if your API key is invalid or missing, and a 402 error if you have insufficient credit. It is important to handle these errors gracefully in your application. For example, if you receive a 401 error, you should prompt the user to re-authenticate or check their API key. If you receive a 402 error, you should notify the user that they need to top up their account.
Additionally, the API may return other standard HTTP errors, such as 400 for bad requests or 500 for server errors. It is good practice to log these errors for debugging purposes. If you encounter a 500 error, it may be a temporary issue on the server side, so you can retry the request after a short delay. Consistent error handling ensures that your application remains stable and provides a good user experience even when things go wrong.
When designing your application, consider the impact of rate limits on your workflow. If you are processing large batches of data, you may need to chunk your requests to stay within the limit. This can help in maintaining a steady flow of requests without hitting the rate limit. Proper rate limit management ensures that your application can handle high volumes of traffic without degradation in performance.
When Our API Is Not the Right Choice
While our API is excellent for text generation, it may not be the right choice for every project. If your application requires image generation, audio processing, or video synthesis, our text-only API will not meet your needs. We do not offer embeddings, OCR, or fine-tuning capabilities. If you need to convert speech to text or text to speech, you will need to integrate with a separate service. Understanding these limitations helps you decide if our API fits your specific requirements.
Another scenario where our API might not be ideal is if you need model routing. Our service serves only one uncensored open-weight text model. If you need to switch between different models based on the task or user preference, our API does not support this feature. You would need to build your own routing logic or use a platform that offers multiple models. This is an important consideration for applications that require flexibility in model selection.
Additionally, if you are looking for a service with a free unlimited tier, our prepaid credit model may not be suitable. We offer a small trial credit of $0.50 for new accounts, but ongoing usage requires payment. If you are building a prototype or a small project, this may be acceptable, but for large-scale production applications, the cost structure may need to be evaluated carefully. Ensure that your budget can support the prepaid model before committing to our API.
Finally, if you need advanced features like SLA guarantees, certifications, or on-prem deployment, our service may not be the best fit. We are an independent service focused on providing high-quality text generation without the overhead of enterprise features. If your organization requires strict compliance or specific deployment options, you may need to look for a more enterprise-focused provider. Understanding these trade-offs helps you make an informed decision about whether our API is the right tool for your project.
Frequently asked questions
How do I authenticate with the API?
Include your API key in the Authorization header as a Bearer token. You can get your key after signing up with Google or email. Keep it secure and never expose it in public code.
What is the context window size?
The context window is 100,000 tokens, which includes both the prompt and the completion. This allows for long conversations and large documents to be processed in a single request.
Can I use credit cards to pay?
No, we only accept crypto payments. You can top up with USDT on TRC20 or USDC on Base. The minimum amount is $20, and you get a bonus for larger top-ups.
What happens if I hit the rate limit?
You will receive a 429 error. You should wait for a short period and retry your request. Implementing exponential backoff in your client can help manage this gracefully.