Skip to content

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

@Nilesh9106

Description

@Nilesh9106

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

// 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions