--header 'x-portkey-config: {"cache": {"mode": "semantic"}}'
curl https://api.portkey.ai/v1/chat/completions \ -H "Content-Type: application/json" \ -H "x-portkey-api-key: apikeyiek2" \ -H "x-portkey-virtual-key: open-ai-key-virtual" \ -H "x-portkey-config: {"cache": {"mode": "semantic"}}" \ -d '{ "model": "gpt-3.5-turbo", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ] }'
{"status":"failure","message":"Invalid config passed. You need to pass a valid json"}
x-portkey-config
, then API call successfully flies. Let me know if you find something wrong with the Curl request.curl https://api.portkey.ai/v1/chat/completions \ -H 'Content-Type: application/json' \ -H 'x-portkey-api-key: apikeyiek2' \ -H 'x-portkey-virtual-key: open-ai-key-virtual' \ -H 'x-portkey-config: {"cache": {"mode": "semantic"}}' \ -d '{ "model": "gpt-3.5-turbo", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ] }'
curl --request POST \ --url https://api.portkey.ai/v1/chat/completions \ --header 'Content-Type: application/json' \ --header 'x-portkey-api-key: IxXxxxxxxxxHZxkAxxxxxxxx=' \ --header 'x-portkey-config: {"strategy":{"mode":"loadbalance"},"targets":[{"virtualKey":"openai-virtual-key","weight":0.7},{"virtualKey":"azure-virtual-key","weight":0.3}]}' \ --header 'x-portkey-virtual-key: open-ai-key-04ba3e' \ --data '{ "model": "gpt-3.5-turbo", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ] }'
x-portkey-virtual-key
too.{ "status": "failure", "message": "Invalid config passed", "errors": [ "path: targets,0, message: Invalid configuration. It must have either 'provider' and 'api_key', or 'strategy' and 'targets', or 'cache', or 'target'", "path: targets,1, message: Invalid configuration. It must have either 'provider' and 'api_key', or 'strategy' and 'targets', or 'cache', or 'target'" ] }
cache
and loadbalance
in the same config. Is my understanding correct?curl --request POST \ --url https://api.portkey.ai/v1/chat/completions \ --header 'Content-Type: application/json' \ --header 'x-portkey-api-key: apikey=' \ --header 'x-portkey-config: {"retry":{"attempts":3},"cache":{"mode":"simple"},"strategy":{"mode":"loadbalance"},"targets":[{"virtual_key":"open-ai-key","weight":0.7},{"virtual_key":"test-virtual-ke","weight":0.3}]}' \ --header 'x-portkey-virtual-key: open-ai-key' \ --data '{ "model": "gpt-3.5-turbo", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ] }'