artem_ml5 May 2025 02:42

Tested both APIs for a document analysis task. Sharing observations on the PHP side: client libraries, rate limits, and response characteristics.

No official Anthropic PHP SDK (as of writing). Used a Guzzle wrapper around the REST API directly.

Replies (5)
alex_petrov5 May 2025 02:56

There are community PHP wrappers for Claude (claude-php and a few others on Packagist). Thin wrappers around Guzzle with message formatting. Nothing as polished as openai-php/client but functional.

0
sergey_web5 May 2025 03:42

The message format is slightly different: Claude uses a messages array like OpenAI but the system prompt goes in a separate system field, not as a role: system message. Easy to miss.

0
artem_ml5 May 2025 03:52

Claude 3 Haiku is very fast and cheap for classification and extraction tasks. Performance is close to GPT-3.5 but with better instruction following. For our document parsing pipeline we switched to Haiku and costs dropped 70%.

0
vova5 May 2025 04:57

Rate limits on Claude are tighter per-minute but higher per-day. If you have bursty traffic, OpenAI handles it better. If you have sustained steady throughput, Claude limits are fine.

0
katedev5 May 2025 05:07

Streaming with Claude works the same as OpenAI (SSE format). The event types are slightly different: content_block_delta instead of a delta field directly. Easy to adapt existing streaming code.

0