Skip to content

Instantly share code, notes, and snippets.

View vrushankportkey's full-sized avatar

Vrushank Vyas vrushankportkey

View GitHub Profile
@vrushankportkey
vrushankportkey / langchain_anyscale.py
Last active October 26, 2023 07:27
Langchain <> Anyscale <> Portey
import os
from langchain.chat_models import ChatOpenAI
from langchain.schema import HumanMessage, SystemMessage
os.environ["OPENAI_API_BASE"]="https://api.portkey.ai/v1/proxy"
anyscale_key = "..."
headers = {
"x-portkey-api-key": "...",
"x-portkey-mode": "proxy anyscale",
@vrushankportkey
vrushankportkey / portkey-api.cs
Created October 25, 2024 15:13
Calling the Portkey API in C#
// dotnet add package RestSharp
using RestSharp;
using System;
using System.Threading.Tasks;
public class Program
{
private static readonly string PortkeyApiKey = Environment.GetEnvironmentVariable("PORTKEY_API_KEY");
private static readonly string OpenAiVirtualKey = "YOUR_OPENAI_VIRTUAL_KEY";
@vrushankportkey
vrushankportkey / config.json
Created February 11, 2025 15:24
Conditional Config JSON
{
"strategy": {
"mode": "conditional",
"conditions": [
{
"query": {
"metadata.user_provider": {
"$eq": "openai"
}
},
@vrushankportkey
vrushankportkey / prompt-chat-bot.py
Created February 17, 2025 11:49
Portkey Prompt Template
from portkey_ai import Portkey
portkey_tools = []
portkey_tool = {
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current temperature for a given location.",
"parameters": {
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<!-- created with sitemap generator https://octopus.do -->
<url>
<loc>https://portkey.ai/</loc>
<lastmod>2025-03-21</lastmod>
<changefreq>always</changefreq>
<priority>0.5</priority>
</url>
@vrushankportkey
vrushankportkey / langchain-gemini.py
Created March 28, 2025 13:59
Using Portkey in Langchain to call Gemini API
from langchain_openai import ChatOpenAI
from portkey_ai import createHeaders, PORTKEY_GATEWAY_URL
portkey_headers = createHeaders(
api_key="YOUR_PORTKEY_API_KEY",
config={
"virtual_key":"YOUR_GOOGLE_AI_STUDIO_VIRTUAL_KEY",
"override_params":{
"model":"gemini-1.5-pro-latest"
}
@vrushankportkey
vrushankportkey / watson-x-api.yaml
Created May 13, 2025 09:58
Watson X AI Inference
openapi: 3.0.2
info:
version: ml_v1
title: watsonx.ai
license:
name: IBM
url: https://www.ibm.com
x-alternate-name: watsonx_ai_ml
termsOfService: https://www.ibm.com/software/sla/sladb.nsf/sla/bm-6883-09
x-codegen-config:
@vrushankportkey
vrushankportkey / groq.json
Created June 19, 2025 10:52
Groq Pricing on Portkey
{
"default": {
"pricing_config": {
"pay_as_you_go": {
"request_token": {
"price": 0
},
"response_token": {
"price": 0
}

Step #0

Please paste your email addresses in this Teams chat window.


Step #1

You would be invited to your Portkey workspace. Please check your email and accept the invite.