Skip to content

anthropic.BetaFileUploadParams doesn't provide a way to set content-types #234

@WeiyuanSong

Description

@WeiyuanSong

When I tried to upload a PDF file using
resp, err := c.client.Beta.Files.Upload(ctx, anthropic.BetaFileUploadParams{ File: file, Betas: []string{"files-api-2025-04-14"}, }, option.WithHeader("Content-Type","application/pdf"))
It returns {"type":"error","error":{"type":"invalid_request_error","message":"file: Field required"}.
But when I don't specify the content-type, the content-type will default to application/octet-stream, which cannot be specified in Message API because it will complain it doesn't support application/octet-stream.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions