Skip to content

Proxy API forge.tensorblock.co rejects valid OpenAI-compatible payload #24

@dcloud347

Description

@dcloud347

Description

I'm using a proxy (https://api.forge.tensorblock.co/v1/chat/completions) that is supposed to be OpenAI-compatible. When I send the exact same payload to OpenAI's API, it works perfectly. However, when I send the same payload to the Forge proxy, I get a validation error:

curl https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-..." \
  -d @openai_payload.json
# ✅ Response: success
curl https://api.forge.tensorblock.co/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer forge-..." \
  -d @forge_payload.json
# ❌ Response:
{
  "detail": [
    {
      "type": "list_type",
      "loc": ["body", "messages", 2, "content", "list[OpenAIContentModel]"],
      "msg": "Input should be a valid list",
      "input": null
    },
    {
      "type": "string_type",
      "loc": ["body", "messages", 2, "content", "str"],
      "msg": "Input should be a valid string",
      "input": null
    }
  ]
}

Payload

I'm attaching the exact payload as payload.json used in both cases.

Expected Behavior

Since the Forge proxy is advertised as OpenAI-compatible, it should accept and correctly handle payloads that OpenAI accepts — including tool_calls and content: null cases as returned when finish_reason = "tool_calls".

Actual Behavior

The proxy fails with a validation error, specifically rejecting content: null.

Suggested Fix

The proxy implementation should:

  • Accept content: null when tool_calls are present, which is valid OpenAI behavior.
  • Update Pydantic schema (if used) to allow Union[str, None] instead of just str.
  • Make sure messages[].content can be null per OpenAI's official spec.

forge_payload.json

openai_payload.json

Metadata

Metadata

Assignees

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