- OpenAI-kompatible Endpoints bekommen aus model#max reasoning_effort; Anthropic output_config.effort; opencode behält seine Variante. - Ein Rewrite-Ziel (as) kann selbst ein #effort tragen; ein Client-Selektor überlebt den as-Rewrite. Der Cache-Schlüssel bleibt der ursprüngliche Body. - Pool-Member dürfen endpoint/model#effort oder endpoint#effort heißen; ein Regel-as bleibt für Member ohne eigenes Modell in Kraft. - # ist nur am Wortanfang ein Kommentar, innerhalb eines Tokens Daten. - Tests decken Anthropic, OpenAI-kompatibel, as, Pool-Member und rule-as ab.
25 lines
1.1 KiB
C
25 lines
1.1 KiB
C
/* junction/effort.h — the model#effort selector for the HTTP endpoint kinds.
|
|
*
|
|
* OpenAI-compatible endpoints take `reasoning_effort`; Anthropic takes
|
|
* `output_config.effort` (or `thinking.type=disabled` for none); opencode takes
|
|
* the selector as a model variant and handles it in its bridge. The rest of the
|
|
* request body stays as the client wrote it.
|
|
*/
|
|
#ifndef JUNCTION_EFFORT_H
|
|
#define JUNCTION_EFFORT_H
|
|
|
|
#include <stddef.h>
|
|
|
|
/* Normalize an OpenAI-style effort request for the Anthropic Messages API.
|
|
* Returns 0 and a malloc'ed body in *out / *out_len when something changed.
|
|
* Returns -1 and leaves *out NULL when the body needs no rewrite or is not a
|
|
* JSON object. The caller owns *out. */
|
|
int j_effort_anthropic(const char *body, size_t len, char **out, size_t *outlen);
|
|
|
|
/* Normalize a model#effort selector for an OpenAI-compatible endpoint: the
|
|
* suffix becomes `reasoning_effort`, the model keeps its real ID. Returns 0 and
|
|
* a malloc'ed body in *out / *out_len when something changed; -1 otherwise. */
|
|
int j_effort_openai(const char *body, size_t len, char **out, size_t *outlen);
|
|
|
|
#endif
|