#1583·gateway

Tool calls and file inputs fail with Responses API via Portkey for OpenAI, Azure OpenAI, and Bedrock

Author: Nilesh9106Created Mar 28, 2026Updated Sep 10, 2026
Labelsbugtriage

What Happened?

  • Tool calls fail when using Responses API via Portkey
  • Works fine when using direct OpenAI (ChatOpenAI)
  • Bedrock errors:
    • messages.1 content is empty
    • toolResult blocks exceed toolUse blocks
  • Azure OpenAI error via Portkey:
    • ModelNotFound even though model exists
  • Completion API works for tool calls but fails for file inputs
  • File-related errors:
    • Azure: missing messages[1].content[0].file
    • Bedrock: invalid DocumentSource (expects bytes or s3Location)

What Should Have Happened?

  • Tool calls should work consistently via Portkey with Responses API
  • File inputs should be handled correctly across providers
  • Azure models should resolve correctly via Portkey
  • Behavior should match direct provider integrations

Relevant Code Snippet

typescript
// not working
const azureChatOpenAI = new ChatOpenAI({
  model: '@openai-5-4-studio/gpt-5.4',
  useResponseApi:true,
  configuration: {
    baseURL: 'https://api.portkey.ai/v1',
    apiKey: config.portkey.apiKey,
    defaultHeaders: {
      'x-portkey-metadata': metadata,
    },
  },
});

// working
const azureChatOpenAI = new ChatOpenAI({
  model: 'gpt-5.4-studio',
  useResponseApi:true,
  configuration: {
    baseURL: azureBaseUrl,
    apiKey: azureApiKey
  },
});

Your Twitter/LinkedIn

https://x.com/thenileshdarji