EN ▾
Get API key

Integrating OpenAI Compatible API with VS Code

Many developers struggle when VS Code extensions ignore custom provider configurations or fail to connect to third-party endpoints. This guide provides a tested checklist for configuring your environment, ensuring your tools connect reliably to our uncensored text API.

Developer desk with laptop showing API integration code and network nodes

Understanding the Integration Challenge

Setting up an OpenAI compatible API in VS Code often feels straightforward until you encounter configuration quirks. Extensions like Cline or Zed Editor expect specific endpoint structures and token handling mechanisms. When these do not align with your provider's setup, the extension may silently fail or fall back to a default provider, causing confusion.

The core issue usually stems from how the extension handles the base URL and authentication headers. Our API uses the standard /v1/chat/completions endpoint, which should be compatible with most tools. However, some extensions hardcode their own logic for token counting or streaming, which can lead to discrepancies in usage tracking.

It is important to remember that our service is an independent host. It does not inherit the SLA or feature set of the original OpenAI platform. When configuring your tools, you are connecting to a specific uncensored model via our infrastructure. This means you must manage your own API keys and monitor your token usage directly through our dashboard.

Before diving into specific extensions, ensure you have generated an API key from our signup page. You can use Google or email to create an account. The key is shown immediately upon creation. Keep this key secure, as it is the only credential needed to access the API for text generation tasks.

Configuring Cline for Custom Providers

Cline is a popular VS Code extension for AI coding assistance. Users have reported issues where Cline ignores custom provider configurations and falls back to the default OpenAI endpoint. This often happens when the extension detects a mismatch in the expected API structure or when the base URL is not correctly formatted.

To fix this, ensure you select the 'OpenAI-compatible' provider option within the Cline settings. Enter the base URL as https://api.openaicompatibleapi.com/v1. Make sure to include the trailing slash if required by your version of the extension. Paste your API key into the designated field.

Verify that the model ID is set to uncensored. This is the specific identifier for our uncensored open-weight text model. If the extension allows you to select a model, choose this one. If it defaults to a different model, you may need to override this in the settings.

Test the connection by asking a simple question. If the response is delayed or incorrect, check the extension logs. Look for any error messages related to authentication or rate limits. Remember that our API has a limit of 300 requests per minute per key. If you exceed this, you will receive a 429 error.

Setting Up Zed Editor Predictions

Zed Editor offers powerful edit predictions using Fill-in-the-Middle (FIM) capabilities. However, not all models support this feature. Users have noted that some providers, like Gemini, may not fully support FIM, leading to failed predictions.

To configure Zed with our API, you need to ensure that the extension supports the specific model you are using. Our API serves a text model that supports standard chat completions. If the extension requires a specific FIM endpoint, verify that our API supports it or adjust your expectations.

Enter the base URL https://api.openaicompatibleapi.com/v1 in the Zed settings. Use the API key generated from our platform. Ensure that the temperature and other parameters are set according to your preferences. Our API supports parameters like temperature, top_p, and stop sequences.

If predictions do not work, check the Zed logs for errors. You may need to update the extension to the latest version, as newer versions often include better support for custom providers. Keep in mind that our API is text-only, so it may not support advanced features like image generation or audio processing.

Troubleshooting Common Errors

When integrating with VS Code extensions, you may encounter several common errors. The most frequent is a 401 error, which indicates an invalid or missing API key. Ensure that you have copied the key correctly and that it has not expired. Our prepaid credit never expires, but the key itself must be valid.

A 402 error means you have no credit left. Our API charges $0.15 per 1M input tokens and $0.50 per 1M output tokens. You can top up using crypto, such as USDT on TRC20 or USDC on Base. The minimum top-up is $20, and the maximum is $500. New accounts receive $0.50 of trial credit.

A 429 error indicates that you have hit the rate limit of 300 requests per minute. If you are making many rapid requests, you may need to add a delay between them. This is common in automated scripts or when using multiple instances of an extension.

Always check the extension logs for detailed error messages. This will help you identify whether the issue is with the configuration, the network, or the API itself. Remember that our API is designed for text input and output, so errors related to image or audio processing are expected if you try to use it for those purposes.

When This API Is Not the Right Choice

While our API is excellent for text generation, it may not be the right choice for all projects. If you need image generation, audio processing, or video creation, our API does not support these features. It is a text-only service, so you will need to use a different provider for multimodal tasks.

Additionally, if you require fine-tuning of the model, our API does not offer this capability. You can only use the pre-trained uncensored model. If you need to customize the model's behavior through fine-tuning, you may need to look for a provider that offers this feature.

Our API also does not support embeddings, OCR, or model routing. If your project relies on these features, our API may not meet your needs. It is important to assess your project requirements before committing to a provider.

Finally, if you need a provider with a specific SLA or certification, such as SOC2 or HIPAA, our API does not claim these. It is an independent service focused on providing uncensored text generation. Always verify that the provider meets your specific compliance and reliability needs.

Addressing Community Questions

Users on Reddit have raised several questions about integrating OpenAI compatible APIs with VS Code. One common issue is that extensions like Cline may ignore custom provider configurations. This is often due to the extension not fully supporting the specific API structure of third-party providers.

Another question relates to Zed Editor's edit predictions. Users have noted that not all models support Fill-in-the-Middle (FIM). If you are using a model that does not support FIM, your predictions may fail. It is important to check the model's capabilities before configuring your editor.

Some users have also asked about the cost of using these APIs. While our API offers competitive pricing, it is important to monitor your token usage. You can top up your credit using crypto, and your prepaid credit never expires. This makes it easy to manage your budget.

Finally, users have asked about the reliability of third-party providers. While our API is designed to be compatible with OpenAI's format, it is an independent service. Always check the provider's documentation for the latest updates on features, limits, and pricing.

Best Practices for Integration

To ensure a smooth integration, follow these best practices. First, always use the latest version of your VS Code extension. Newer versions often include better support for custom providers and bug fixes.

Second, monitor your token usage regularly. Our API charges by the token, so it is important to keep track of your usage. You can view your usage in the dashboard. If you notice unusual activity, check your API key and extension settings.

Third, test your integration thoroughly before using it in production. Ask a series of questions to ensure that the API is responding correctly. Check for any errors in the extension logs.

Finally, keep your API key secure. Do not share it publicly or commit it to your code repository. Use environment variables to store the key in your development environment. This will help prevent unauthorized access to your account.

Frequently asked questions

Why does Cline ignore my custom provider config?

Cline may fall back to the default endpoint if it detects a mismatch in the API structure. Ensure you select the 'OpenAI-compatible' provider and enter the correct base URL. Also, verify that the model ID is set to 'uncensored'.

Does the API support image generation?

No, this is a text-only API. It does not support image, audio, or video generation. If you need multimodal features, you will need to use a different provider for those tasks.

How do I top up my credit?

You can top up your credit using crypto, specifically USDT on TRC20 or USDC on Base. The minimum top-up is $20, and the maximum is $500. Your prepaid credit never expires.

What is the rate limit for the API?

The rate limit is 300 requests per minute per key. If you exceed this limit, you will receive a 429 error. You can add a delay between requests to avoid hitting the limit.

$0.15per 1M input tokens

Get API key