Skip to content

Comments

Feature/AI-Gateway#279

Open
0xCAB0 wants to merge 2 commits intocloudflare:mainfrom
0xCAB0:feature/ai-gateway-api-mapping
Open

Feature/AI-Gateway#279
0xCAB0 wants to merge 2 commits intocloudflare:mainfrom
0xCAB0:feature/ai-gateway-api-mapping

Conversation

@0xCAB0
Copy link

@0xCAB0 0xCAB0 commented Feb 21, 2026

Summary

  • Replace hardcoded ternary with extensible apiMap object that maps Cloudflare AI Gateway provider names to OpenClaw ModelApi types
  • Adds support for additional providers beyond just Anthropic
  • Defaults to openai-completions for unmapped providers

Supported mappings

CF AI Gateway Provider OpenClaw ModelApi
anthropic anthropic-messages
google-ai-studio google-generative-ai
bedrock bedrock-converse-stream
workers-ai/ollama ollama
Others (openai, workersai, groq, etc.) openai-completions

References

Test plan

  • Verify CF_AI_GATEWAY_MODEL=anthropic/claude-sonnet-4-5 sets api: "anthropic-messages"
  • Verify CF_AI_GATEWAY_MODEL=google-ai-studio/gemini-pro sets api: "google-generative-ai"
  • Verify CF_AI_GATEWAY_MODEL=openai/gpt-4o defaults to api: "openai-completions"
  • Verify CF_AI_GATEWAY_MODEL=workersai/@cf/meta/llama-3.3-70b-instruct-fp8-fast defaults to api: "ollama"
  • Verify CF_AI_GATEWAY_MODEL=workersai/@cf/workers-ai/@cf/openai/gpt-oss-120b defaults to api: "openai-completions"

@0xCAB0 0xCAB0 force-pushed the feature/ai-gateway-api-mapping branch from 4ff501d to 9b513be Compare February 21, 2026 18:04
Replace hardcoded ternary with extensible apiMap object that maps
Cloudflare AI Gateway provider names to OpenClaw ModelApi types.

Supported mappings:
- anthropic → anthropic-messages
- google-ai-studio → google-generative-ai
- bedrock → bedrock-converse-stream
- workers-ai → parses @cf/<vendor>/<model> to select API:
  - @cf/meta/* (LLaMA) → ollama
  - @cf/openai/*, @cf/mistral/*, etc. → openai-completions
- All others default to openai-completions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@0xCAB0 0xCAB0 force-pushed the feature/ai-gateway-api-mapping branch from 9b513be to 8434d24 Compare February 21, 2026 18:11
@0xCAB0 0xCAB0 marked this pull request as ready for review February 21, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant