## What
Adds a new remote inference provider (`remote::meta`) for the
OpenAI-compatible **Meta AI API** endpoint (`api.meta.ai`), supporting
three API surfaces:
- **Chat Completions** (`/v1/chat/completions`) — via `OpenAIMixin`
- **Responses** (`/v1/responses`) — via OGX's built-in responses
provider, reconstructed over chat completions (same path as every
OpenAI-compatible provider; usage is mapped from the underlying
chat-completion `usage`)
- **Anthropic Messages** (`/v1/messages` + `/v1/messages/count_tokens`)
— the adapter overrides `anthropic_messages()` /
`anthropic_count_tokens()` to forward **natively** to `api.meta.ai`,
instead of the `OpenAIMixin` translation fallback (following the
`InferenceProvider.anthropic_messages()` pattern from #6264, same as
Ollama/vLLM)
## Changes
- New adapter package `src/ogx/providers/remote/inference/meta/`
(`config.py`, `meta.py`, `__init__.py`); `base_url` defaults to
`https://api.meta.ai/v1`, API key from `META_API_KEY` / `meta_api_key`
provider-data field
- Registered `RemoteProviderSpec` for `remote::meta` in
`providers/registry/inference.py`
- Native Anthropic Messages + count_tokens passthrough implemented on
the adapter, mirroring the Ollama adapter
- Enabled in the `starter` distribution (`ENABLED_INFERENCE_PROVIDERS` +
`META_API_KEY` env var); distro/provider codegen regenerated (starter +
ci-tests configs, `docs/.../remote_meta.mdx`)
- Added a parametrized case to `test_inference_client_caching.py`
- Mapped `meta` in `scripts/generate_target_models_docs.py`
(`INTENTIONALLY_UNMAPPED_REGISTRY_PROVIDERS`) to keep the
`target-model-matrix` pre-commit hook in sync (no dedicated
integration-test setup yet)
No `ogx_api/` (public API surface) changes, so no OpenAPI regeneration
required. Branch is merged up to date with `main`.
## Test plan
### Automated
```
# unit
uv run pytest tests/unit/providers/inference/test_inference_client_caching.py \
tests/unit/providers/inline/messages/ -q
# 21 passed
# lint / type
uv run ruff check src/ogx/providers/remote/inference/meta # All checks passed!
uv run mypy src/ogx/providers/remote/inference/meta # Success: no issues found in 3 source files
# pre-commit
uv run pre-commit run --all-files # pre-commit CI check: pass
```
CI: all checks green (pre-commit, `Analyze (python)`/mypy, builds, and
the full integration-test matrix).
### End-to-end against the live endpoint
Server started from the `starter` distribution with `META_API_KEY` set;
model `meta/muse-spark-1.1`. Every surface verified **through OGX** and,
as a control, **directly against `api.meta.ai`**.
| Surface | OGX endpoint | Through OGX | Direct to api.meta.ai | Notes |
|---|---|---|---|---|
| Chat Completions | `POST /v1/chat/completions` | 200 | 200 (Bearer) |
`object: chat.completion` |
| Responses | `POST /v1/responses` | 200 | 200 (Bearer) | `object:
response`; `usage.input_tokens` matches direct (8 == 8),
`cached_tokens`/`reasoning_tokens` preserved |
| Messages | `POST /v1/messages` | 200 (native `anthropic_messages`) |
200 (x-api-key) | native Anthropic `redacted_thinking` block returned —
cannot be produced by the translation path, confirming native forwarding
|
| Count Tokens | `POST /v1/messages/count_tokens` | 200
`{"input_tokens":9}` | 200 `{"input_tokens":9}` | native
`anthropic_count_tokens` passthrough |
Example (messages through OGX):
```
$ curl http://localhost:8321/v1/messages -H "anthropic-version: 2023-06-01" \
-d '{"model":"meta/muse-spark-1.1","max_tokens":2048,
"messages":[{"role":"user","content":"Reply with exactly: messages works"}]}'
# -> blocks ['redacted_thinking', 'text'] text ['messages works']
# server log: "Using native /v1/messages passthrough" ... POST /v1/messages 200
```
Notes:
- The Meta model must be referenced with the `meta/` prefix so the
router resolves it to this provider.
- The native `/v1/messages` path forwards with `x-api-key`;
chat/responses use `Authorization: Bearer`.
---------
Signed-off-by: Raghotham Murthy <rsm@meta.com>