Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion api-reference/inference-api/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ from portkey_ai import Portkey

client = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your actual API key
virtual_key="VIRTUAL_KEY" # Optional: Use if virtual keys are set up
provider="@VIRTUAL_KEY" # Optional: Use if virtual keys are set up
)

chat_completion = client.chat.completions.create(
Expand Down
30 changes: 15 additions & 15 deletions api-reference/inference-api/gateway-for-other-apis.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ Portkey integrates with 40+ LLM providers. Add your provider credentials (such a
curl https://api.portkey.ai/v1/rerank \
-H "Content-Type: application/json" \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY" \
-H "x-portkey-virtual-key: $PORTKEY_PROVIDER" \
```

```py Python
from portkey_ai import Portkey

portkey = Portkey(
api_key = "PORTKEY_API_KEY",
virtual_key = "PROVIDER_VIRTUAL_KEY"
virtual_key = "PROVIDER"
)
```

Expand All @@ -65,7 +65,7 @@ import Portkey from 'portkey-ai';

const portkey = new Portkey({
apiKey: 'PORTKEY_API_KEY',
virtualKey: 'PROVIDER_VIRTUAL_KEY'
virtualKey: 'PROVIDER'
});
```
</CodeGroup>
Expand Down Expand Up @@ -181,15 +181,15 @@ curl --request GET \
--url https://api.portkey.ai/v1/collections \
--header 'Content-Type: application/json' \
--header 'x-portkey-api-key: $PORTKEY_API_KEY' \
--header 'x-portkey-virtual-key: $PROVIDER_VIRTUAL_KEY'
--header 'x-portkey-virtual-key: $PROVIDER'
```

```bash PUT
curl --request PUT \
--url https://api.portkey.ai/v1/collections/my-collection \
--header 'Content-Type: application/json' \
--header 'x-portkey-api-key: $PORTKEY_API_KEY' \
--header 'x-portkey-virtual-key: $PROVIDER_VIRTUAL_KEY' \
--header 'x-portkey-virtual-key: $PROVIDER' \
--data '{
"metadata": {
"description": "Updated collection description"
Expand All @@ -202,7 +202,7 @@ curl --request DELETE \
--url https://api.portkey.ai/v1/collections/my-collection \
--header 'Content-Type: application/json' \
--header 'x-portkey-api-key: $PORTKEY_API_KEY' \
--header 'x-portkey-virtual-key: $PROVIDER_VIRTUAL_KEY'
--header 'x-portkey-virtual-key: $PROVIDER'
```
</CodeGroup>
</Tab>
Expand All @@ -216,7 +216,7 @@ from portkey_ai import Portkey

portkey = Portkey(
api_key="PORTKEY_API_KEY",
virtual_key="PROVIDER_VIRTUAL_KEY"
provider="@PROVIDER"
)

response = portkey.post(
Expand All @@ -235,7 +235,7 @@ from portkey_ai import Portkey

portkey = Portkey(
api_key="PORTKEY_API_KEY",
virtual_key="PROVIDER_VIRTUAL_KEY"
provider="@PROVIDER"
)

response = portkey.get('/collections')
Expand All @@ -246,7 +246,7 @@ from portkey_ai import Portkey

portkey = Portkey(
api_key="PORTKEY_API_KEY",
virtual_key="PROVIDER_VIRTUAL_KEY"
provider="@PROVIDER"
)

response = portkey.put(
Expand All @@ -262,7 +262,7 @@ from portkey_ai import Portkey

portkey = Portkey(
api_key="PORTKEY_API_KEY",
virtual_key="PROVIDER_VIRTUAL_KEY"
provider="@PROVIDER"
)

response = portkey.delete('/collections/my-collection')
Expand All @@ -279,7 +279,7 @@ import Portkey from 'portkey-ai';

const portkey = new Portkey({
apiKey: "PORTKEY_API_KEY",
virtualKey: "PROVIDER_VIRTUAL_KEY"
virtualKey: "PROVIDER"
});

const response = await portkey.post('/rerank', {
Expand All @@ -297,7 +297,7 @@ import Portkey from 'portkey-ai';

const portkey = new Portkey({
apiKey: "PORTKEY_API_KEY",
virtualKey: "PROVIDER_VIRTUAL_KEY"
virtualKey: "PROVIDER"
});

const response = await portkey.get('/collections');
Expand All @@ -308,7 +308,7 @@ import Portkey from 'portkey-ai';

const portkey = new Portkey({
apiKey: "PORTKEY_API_KEY",
virtualKey: "PROVIDER_VIRTUAL_KEY"
virtualKey: "PROVIDER"
});

const response = await portkey.put('/collections/my-collection', {
Expand All @@ -323,7 +323,7 @@ import Portkey from 'portkey-ai';

const portkey = new Portkey({
apiKey: "PORTKEY_API_KEY",
virtualKey: "PROVIDER_VIRTUAL_KEY"
virtualKey: "PROVIDER"
});

const response = await portkey.delete('/collections/my-collection');
Expand All @@ -343,7 +343,7 @@ from portkey_ai import Portkey

portkey = Portkey(
api_key="PORTKEY_API_KEY",
virtual_key="COHERE_VIRTUAL_KEY"
provider="@COHERE_VIRTUAL_KEY"
)

response = portkey.post(
Expand Down
2 changes: 1 addition & 1 deletion api-reference/inference-api/headers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ from portkey_ai import Portkey

portkey = Portkey(
api_key="PORTKEY_API_KEY",
virtual_key="VIRTUAL_KEY",
provider="@VIRTUAL_KEY",
config="CONFIG_ID"
)

Expand Down
10 changes: 5 additions & 5 deletions api-reference/sdk/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ from portkey_ai import Portkey

client = Portkey(
api_key="your_api_key_here", # Or use the env var PORTKEY_API_KEY
virtual_key="your_virtual_key_here" # Or use config="cf-***"
provider="@your_virtual_key_here" # Or use config="cf-***"
)

response = client.chat.completions.create(
Expand All @@ -67,7 +67,7 @@ The SDK requires:

```python
# With Virtual Key
portkey = Portkey(api_key="...", virtual_key="...")
portkey = Portkey(api_key="...", provider="@...")

# With Config
portkey = Portkey(api_key="...", config="cf-***")
Expand All @@ -87,7 +87,7 @@ from portkey_ai import AsyncPortkey

portkey = AsyncPortkey(
api_key="PORTKEY_API_KEY",
virtual_key="VIRTUAL_KEY"
provider="@VIRTUAL_KEY"
)

async def main():
Expand Down Expand Up @@ -117,7 +117,7 @@ custom_client = httpx.Client(verify=False)

portkey = Portkey(
api_key="your_api_key_here",
virtual_key="your_virtual_key_here",
provider="@your_virtual_key_here",
http_client=custom_client
)

Expand Down Expand Up @@ -157,7 +157,7 @@ Here's how you can use these headers with the Python SDK:
```python
portkey = Portkey(
api_key="PORTKEY_API_KEY",
virtual_key="VIRTUAL_KEY",
provider="@VIRTUAL_KEY",
# Add any other headers from the reference
)

Expand Down
Loading
Loading