# QuickSilver API

Welcome to the QuickSilver API! This guide will help you quickly set up your API key and choose the best integration method for your needs.

{% hint style="success" %}

### OpenAI-Compatible Interface

QuickSilver API is fully compatible with OpenAI’s Chat Completions API.

If you’re already using OpenAI’s API, you can switch to QuickSilver with minimal or no changes to your existing integration.
{% endhint %}

### API Key Setup

Before you can use the Quicksilver API, you must create and manage your API key.

👉 View [#api-key-setup](#api-key-setup "mention")

Your API key is required for all requests and should be included in the Authorization header:

```
Authorization: Bearer your-api-key
```

Keep this key secure and never expose it publicly.

### Integration Methods

QuickSilver supports multiple integration paths to suit your environment:

<table data-header-hidden><thead><tr><th width="188.5062255859375">Method</th><th>Description</th></tr></thead><tbody><tr><td><a href="/pages/cSFyZNMZMMjEdLnkMNfN">Python SDK</a></td><td>Use the OpenAI-compatible Python client</td></tr><tr><td><a href="/pages/V3FVqSpCcAz0tewHheyd">JavaScript (async)</a></td><td>Ideal for browser-based or Node.js applications</td></tr><tr><td><a href="/pages/AaHYebi5L0C6W1JknHxi">HTTP (cURL)</a></td><td>Direct HTTP requests using tools like curl</td></tr><tr><td><a href="/pages/3zlorS0GaSU8SYIMwqUu">CLI Interface</a></td><td>Test and automate with our command-line tool</td></tr><tr><td><a href="/pages/qY5gDU6dAlgjph1On8dR">MCP Protocol</a></td><td>Integrate via Model Context Protocol clients</td></tr><tr><td><a href="/pages/ooDxQUrPzTX5IR8JHOrn">Widget Embed</a></td><td>Add a chat widget directly to your website</td></tr><tr><td><a href="/pages/M336t7Cz7gmMQkpv6WB7">Cherry Studio</a></td><td>Use QuickSilver in the desktop client</td></tr></tbody></table>

### API Endpoints

#### Base URL

```
https://api-quicksilver.iotex.ai/v1
```

#### Chat Completions

Use this to send chat messages and receive assistant replies (OpenAI-compatible).

```
POST /chat/completions
```

#### Streaming Endpoint

Use this endpoint for streaming responses in real time.

```
GET /sse?authorization=your-api-key
```

### Error Handling

The API returns standard HTTP status codes and JSON-formatted errors (compatible with OpenAI’s error structure).

Example error response:

```json
{
  "error": {
    "message": "Invalid API key provided",
    "type": "invalid_request_error",
    "code": "invalid_api_key"
  }
}
```

### Usage Tips

* The API is fully compatible with OpenAI’s Chat Completions interface
* Secure your API key — never share it publicly
* For multi-turn conversations, pass previous messages in the messages array
* Use the SSE endpoint for streaming responses in real time
* All communication is encrypted via HTTPS

### Need help?

* [Contact Support](mailto:developers@iotex.io) – Reach out for technical assistance
* Refer to [OpenAI client documentation](https://platform.openai.com/docs/) for help with SDK usage


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.iotex.io/quicksilver/developers/quicksilver-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
