-
Notifications
You must be signed in to change notification settings - Fork 40
docs: add HPC-AI integration #824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lioZ129
wants to merge
3
commits into
Portkey-AI:main
Choose a base branch
from
lioZ129:docs/add-hpc-ai-integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| --- | ||
| title: "HPC-AI" | ||
| --- | ||
|
|
||
| ## Portkey + HPC-AI | ||
|
|
||
| [Portkey](https://app.portkey.ai/) is the control plane for AI apps: AI Gateway, observability, prompt management, and more. | ||
|
|
||
| [HPC-AI](https://www.hpc-ai.com/) offers **Model APIs** with an **OpenAI-compatible** interface for chat completions. | ||
|
|
||
| ### Quickstart | ||
|
|
||
| Portkey is compatible with the OpenAI request shape. Point the OpenAI client at the Portkey gateway and pass `provider` + your Portkey API key via `createHeaders`. | ||
|
|
||
| You need: | ||
|
|
||
| * A Portkey API key from [the Portkey app](https://app.portkey.ai/) | ||
| * An HPC-AI API key from [HPC-AI](https://www.hpc-ai.com/) | ||
|
|
||
| ```sh | ||
| pip install -qU portkey-ai openai | ||
| ``` | ||
|
|
||
| ### With OpenAI Client | ||
|
|
||
| ```python | ||
| from openai import OpenAI | ||
| from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders | ||
|
|
||
| client = OpenAI( | ||
| api_key="YOUR_HPC_AI_API_KEY", | ||
| base_url=PORTKEY_GATEWAY_URL, | ||
| default_headers=createHeaders( | ||
| provider="hpc-ai", | ||
| api_key="YOUR_PORTKEY_API_KEY", | ||
| ), | ||
| ) | ||
|
|
||
| chat_complete = client.chat.completions.create( | ||
| model="minimax/minimax-m2.5", | ||
| messages=[{"role": "user", "content": "Who are you?"}], | ||
| ) | ||
|
|
||
| print(chat_complete.choices[0].message.content) | ||
| ``` | ||
|
|
||
| ### Observability | ||
|
|
||
| Routing through Portkey lets you track tokens, latency, cost, and more in the Portkey dashboard. | ||
|
|
||
| For the full integration page (Model Catalog, cURL, and SDK examples), see [/integrations/llms/hpc-ai](/integrations/llms/hpc-ai). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| --- | ||
| title: "HPC-AI" | ||
| description: "Integrate HPC-AI Model APIs (OpenAI-compatible) with Portkey's AI Gateway" | ||
| --- | ||
|
|
||
| Portkey provides a gateway to [HPC-AI](https://www.hpc-ai.com/) **Model APIs**, which expose an **OpenAI-compatible** HTTP API for chat completions. | ||
|
|
||
| With Portkey, use fast routing, observability, prompt management, and secure API keys through [Model Catalog](/product/model-catalog). | ||
|
|
||
| ## Quick Start | ||
|
|
||
| Get HPC-AI working in 3 steps: | ||
|
|
||
| <CodeGroup> | ||
| ```python Python icon="python" | ||
| from portkey_ai import Portkey | ||
|
|
||
| # 1. Install: pip install portkey-ai | ||
| # 2. Add @hpc-ai provider in model catalog | ||
| # 3. Use it: | ||
|
|
||
| portkey = Portkey(api_key="PORTKEY_API_KEY") | ||
|
|
||
| response = portkey.chat.completions.create( | ||
| model="@hpc-ai/minimax/minimax-m2.5", | ||
| messages=[{"role": "user", "content": "Say this is a test"}] | ||
| ) | ||
|
|
||
| print(response.choices[0].message.content) | ||
| ``` | ||
|
|
||
| ```js Javascript icon="square-js" | ||
| import Portkey from 'portkey-ai' | ||
|
|
||
| // 1. Install: npm install portkey-ai | ||
| // 2. Add @hpc-ai provider in model catalog | ||
| // 3. Use it: | ||
|
|
||
| const portkey = new Portkey({ | ||
| apiKey: "PORTKEY_API_KEY" | ||
| }) | ||
|
|
||
| const response = await portkey.chat.completions.create({ | ||
| model: "@hpc-ai/minimax/minimax-m2.5", | ||
| messages: [{ role: "user", content: "Say this is a test" }] | ||
| }) | ||
|
|
||
| console.log(response.choices[0].message.content) | ||
| ``` | ||
|
|
||
| ```python OpenAI Py icon="python" | ||
| from openai import OpenAI | ||
| from portkey_ai import PORTKEY_GATEWAY_URL | ||
|
|
||
| # 1. Install: pip install openai portkey-ai | ||
| # 2. Add @hpc-ai provider in model catalog | ||
| # 3. Use it: | ||
|
|
||
| client = OpenAI( | ||
| api_key="PORTKEY_API_KEY", # Portkey API key | ||
| base_url=PORTKEY_GATEWAY_URL | ||
| ) | ||
|
|
||
| response = client.chat.completions.create( | ||
| model="@hpc-ai/minimax/minimax-m2.5", | ||
| messages=[{"role": "user", "content": "Say this is a test"}] | ||
| ) | ||
|
|
||
| print(response.choices[0].message.content) | ||
| ``` | ||
|
|
||
| ```js OpenAI JS icon="square-js" | ||
| import OpenAI from "openai" | ||
| import { PORTKEY_GATEWAY_URL } from "portkey-ai" | ||
|
|
||
| // 1. Install: npm install openai portkey-ai | ||
| // 2. Add @hpc-ai provider in model catalog | ||
| // 3. Use it: | ||
|
|
||
| const client = new OpenAI({ | ||
| apiKey: "PORTKEY_API_KEY", // Portkey API key | ||
| baseURL: PORTKEY_GATEWAY_URL | ||
| }) | ||
|
|
||
| const response = await client.chat.completions.create({ | ||
| model: "@hpc-ai/minimax/minimax-m2.5", | ||
| messages: [{ role: "user", content: "Say this is a test" }] | ||
| }) | ||
|
|
||
| console.log(response.choices[0].message.content) | ||
| ``` | ||
|
|
||
| ```sh cURL icon="square-terminal" | ||
| # 1. Add @hpc-ai provider in model catalog | ||
| # 2. Use it: | ||
|
|
||
| curl https://api.portkey.ai/v1/chat/completions \ | ||
| -H "Content-Type: application/json" \ | ||
| -H "x-portkey-api-key: $PORTKEY_API_KEY" \ | ||
| -d '{ | ||
| "model": "@hpc-ai/minimax/minimax-m2.5", | ||
| "messages": [ | ||
| { "role": "user", "content": "Say this is a test" } | ||
| ] | ||
| }' | ||
| ``` | ||
| </CodeGroup> | ||
|
|
||
| <Note> | ||
| **Tip:** You can also set `provider="@hpc-ai"` in `Portkey()` and use `model="minimax/minimax-m2.5"` or `model="moonshotai/kimi-k2.5"` in the request. | ||
| </Note> | ||
|
|
||
| ## Open-source AI Gateway | ||
|
|
||
| When self-hosting the [Portkey AI Gateway](https://github.com/Portkey-AI/gateway), set `x-portkey-provider: hpc-ai` and `Authorization: Bearer <HPC_AI_API_KEY>`. The default upstream base URL is `https://api.hpc-ai.com/inference/v1`. Override it with `x-portkey-custom-host` or `custom_host` in your config when needed. | ||
|
|
||
| ## Add Provider in Model Catalog | ||
|
|
||
| 1. Go to [**Model Catalog → Add Provider**](https://app.portkey.ai/model-catalog/providers) | ||
| 2. Select **HPC-AI** (when listed) or add credentials for provider slug `hpc-ai` | ||
| 3. Enter your HPC-AI API key from the [HPC-AI console](https://www.hpc-ai.com/) | ||
| 4. Name your provider (e.g., `hpc-ai-prod`) | ||
|
|
||
| <Card title="Complete Setup Guide →" href="/product/model-catalog"> | ||
| See all setup options, code examples, and detailed instructions | ||
| </Card> | ||
|
|
||
| ## Supported Endpoints | ||
|
|
||
| | Endpoint | Supported | | ||
| |----------|-----------| | ||
| | `/chat/completions` | ✅ | | ||
|
|
||
| Other OpenAI-compatible endpoints may be added as the gateway integration expands. | ||
|
|
||
| ## Supported Models | ||
|
|
||
| Examples available through this integration: | ||
|
|
||
| - `minimax/minimax-m2.5` | ||
| - `moonshotai/kimi-k2.5` | ||
|
|
||
| <Card title="HPC-AI — Model APIs & docs" icon="link" href="https://www.hpc-ai.com/"> | ||
| Product home, pricing, and developer documentation | ||
| </Card> | ||
|
|
||
| ## Next Steps | ||
|
|
||
| <CardGroup cols={2}> | ||
| <Card title="Add Metadata" icon="tags" href="/product/observability/metadata"> | ||
| Add metadata to your HPC-AI requests | ||
| </Card> | ||
| <Card title="Gateway Configs" icon="gear" href="/product/ai-gateway/configs"> | ||
| Add gateway configs to your requests | ||
| </Card> | ||
| <Card title="Tracing" icon="chart-line" href="/product/observability/traces"> | ||
| Trace your requests | ||
| </Card> | ||
| <Card title="Fallbacks" icon="arrow-rotate-left" href="/product/ai-gateway/fallbacks"> | ||
| Set up fallbacks across providers | ||
| </Card> | ||
| </CardGroup> | ||
|
|
||
| <Card title="SDK Reference" icon="code" href="/api-reference/sdk/list"> | ||
| Complete Portkey SDK documentation | ||
| </Card> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.