import requests url = "https://api.portkey.ai/v1/virtual-keys" payload = { "provider": "azure-openai", "key": "openai-test", "name": "Key 1 Azure Open AI", "note": "description", "apiVersion": "a", "deploymentName": "b", "resourceName": "c" } headers = { "x-portkey-api-key": "****", "Content-Type": "application/json" } response = requests.request("POST", url, json=payload, headers=headers) print(response.text) >>>{ "success": false, "data": { "message": "You do not have enough permissions to execute this request", "errorCode": "AB03", "request_id": "27c675d5-c322-4f7e-89cc-064c26c913f9" } }
from langchain_openai import ChatOpenAI from portkey_ai import createHeaders, PORTKEY_GATEWAY_URL PORTKEY_API_KEY = "..." VIRUTAL_KEY = "..." # Virtual Key I created portkey_headers = createHeaders(api_key=PORTKEY_API_KEY,virtual_key= VIRUTAL_KEY) llm = ChatOpenAI(api_key="x", base_url=PORTKEY_GATEWAY_URL, default_headers=portkey_headers, model="gemini-1.5-pro") llm.invoke("What is the meaning of life, universe and everything?")
pip install -U langchain-core portkey_ai langchain-openai
before startingRun Test Request
on the Getting Started Areaasync-openai
crate and now i get some errors, and i dont know how to fix themlet config = OpenAIConfig::new() .with_api_base("https://api.portkey.ai/v1") .with_api_key("portkeyApiKey"); println!("using Portkey"); let openai_client = Arc::new(OpenAIClient::with_config(config));
ERROR async_openai::error: 71: failed deserialization of: {"status":"failure","message":"Either x-portkey-config or x-portkey-provider header is required"}