Skip to content

feat(core): add api_format option to OpenAI/Azure targets#897

Merged
christso merged 1 commit intomainfrom
feat/896-api-format
Apr 1, 2026
Merged

feat(core): add api_format option to OpenAI/Azure targets#897
christso merged 1 commit intomainfrom
feat/896-api-format

Conversation

@christso
Copy link
Copy Markdown
Collaborator

@christso christso commented Apr 1, 2026

Summary

  • Add api_format field ("chat" | "responses") to OpenAI and Azure target configs
  • Default to chat (Chat Completions API) — universally supported by all OpenAI-compatible endpoints
  • Users can opt in to the Responses API with api_format: responses for api.openai.com or Azure OpenAI
  • Add OpenAI section to LLM providers docs with api_format documentation

Changes

File Change
targets.ts Add ApiFormat type, apiFormat to config interfaces, resolveApiFormat() helper
ai-sdk.ts Use .chat() by default, provider(model) only when api_format: responses
targets-validator.ts Add api_format/apiFormat to known settings for OpenAI and Azure
index.ts Export ApiFormat type
targets.test.ts Update OpenAI mock to include .chat() and .responses() methods
llm-providers.mdx Add OpenAI provider section with api_format docs

Test plan

  • All unit tests pass (1304 + 67 + 351)
  • TypeScript typechecks pass
  • Biome lint passes
  • Example YAML validation passes (53/53)
  • Pre-push hooks pass (build, typecheck, lint, test, validate)
  • Manual e2e: run eval with api_format: chat against GitHub Models endpoint
  • Manual e2e: run eval with api_format: responses against OpenAI directly

Closes #896

🤖 Generated with Claude Code

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 1, 2026

Deploying agentv with  Cloudflare Pages  Cloudflare Pages

Latest commit: cf61f74
Status: ✅  Deploy successful!
Preview URL: https://88b6ab91.agentv.pages.dev
Branch Preview URL: https://feat-896-api-format.agentv.pages.dev

View logs

Add api_format field ("chat" | "responses") to OpenAI and Azure target
configs. Defaults to "chat" (Chat Completions API) which is universally
supported by all OpenAI-compatible endpoints. Users can opt in to the
Responses API by setting api_format: responses.

Closes #896

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@christso christso force-pushed the feat/896-api-format branch from 7bec29e to cf61f74 Compare April 1, 2026 09:44
@christso christso merged commit 0ef8cce into main Apr 1, 2026
4 checks passed
@christso christso deleted the feat/896-api-format branch April 1, 2026 11:19
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.

feat: add api_format option to OpenAI/Azure targets (chat vs responses)

1 participant