Ir para o conteúdo

Esta página está disponível em inglês. Sua preferência por português foi mantida para as páginas traduzidas.

OpenAI compatibility

Grid speaks the OpenAI protocol so your existing client works. This page says what is covered today, so you can check before you depend on it.

Compatibility is a floor, not a feature. It is here so that moving to Grid costs you two lines rather than a rewrite, and so that leaving would cost you the same. What Grid asks you to evaluate is portability, routing and the meter, not the shape of the request body.

Using the OpenAI SDKs#

Set the base URL and use the client you already have. Authentication is a bearer token in the standard Authorization header, so nothing about the auth flow changes.

Python

import os
import openai

client = openai.OpenAI(
    base_url="https://api.genai.forlex.cloud/v1",
    api_key=os.environ["FORLEX_API_KEY"],
)
TypeScript

import OpenAI from 'openai'

const client = new OpenAI({
  baseURL: 'https://api.genai.forlex.cloud/v1',
  apiKey: process.env.FORLEX_API_KEY,
})

If you prefer environment variables, OPENAI_BASE_URL and OPENAI_API_KEY work as they normally do, which lets you point an existing application at Grid without touching its code at all.

Endpoints#

EndpointStatus
POST /v1/chat/completionsSupported
GET /v1/modelsSupported
GET /v1/models/{model}Not available yet
POST /v1/completionsNot confirmed
POST /v1/embeddingsNot confirmed
POST /v1/batchesNot available. Grid Batch is a separate surface, see Run modes

GET /v1/models returns the OpenAI list envelope, so SDK helpers that enumerate models work unchanged:

JSON

{
  "object": "list",
  "data": [
    { "id": "livia-e1-flash", "object": "model", "created": 1700000000, "owned_by": "Forlex" },
    { "id": "livia-e1-mini", "object": "model", "created": 1700000000, "owned_by": "Forlex" }
  ]
}

The list is the authority on what you can call. Prefer reading it at runtime over hardcoding a model id, both because the catalog is curated and because it is the one source that cannot be out of date.

Parameters on chat completions#

ParameterStatus
modelSupported. A catalog id, or grid-auto for Smart Router
messagesSupported
streamSupported
tools, tool_choiceSupported
logprobs, top_logprobsNot available yet

Parameters not listed here are not documented as working. That is a statement about what we have verified, not a statement that they fail. If you need one confirmed before you build on it, ask and we will answer specifically rather than generally.

Where Grid differs#

Two differences are worth knowing before you write error handling.

Authentication failures return a plain text body. A request with a missing or invalid key answers 401 with content-type: text/plain, not the JSON {"error": {...}} envelope the OpenAI SDKs expect. The SDKs will surface the status code correctly but may not parse it into a typed error object. If your code branches on a parsed error body, handle the status code as well.

Serverless can answer 503 on a cold lane. The OpenAI API does not scale to zero, so this is a state your existing retry logic may not cover. See Errors and cold start.

Response headers#

Grid adds x-grid-routed-model, naming the model that produced the response. It is present whether or not you used routing, which makes it the single thing to log if you want to be able to reconstruct an answer later.

Solicitar acesso

O acesso às APIs de agentes e do Grid é por convite. Os serviços habilitados e os termos são confirmados nos primeiros passos.

Os rascunhos permanecem nesta visita do navegador. Atualizar a página os apaga.

Tratado conforme nosso Aviso de Privacidade e Proteção de Dados (GDPR, LGPD e CCPA). Nenhum dado pessoal é vendido ou compartilhado.

Fale conosco

Conte quem você é e o que precisa analisar.

Os rascunhos permanecem nesta visita do navegador. Atualizar a página os apaga.

Cada assunto mantém seus requisitos durante esta visita. Alterar o assunto preserva seus dados de contato.

Tratado conforme nosso Aviso de Privacidade e Proteção de Dados (GDPR, LGPD e CCPA). Nenhum dado pessoal é vendido ou compartilhado.

[CONTROLES DE PRIVACIDADE E TELEMETRIA]

Preferências de proteção de dados e telemetria

A Forward Intelligence (operada internacionalmente pela Forlex, LLC e, no Brasil, pela Forlex Ltda) respeita seus direitos nos termos do GDPR da União Europeia e do Reino Unido, da LGPD brasileira (Lei nº 13.709/2018) e da CCPA/CPRA da Califórnia.

Armazenamento estritamente necessárioSempre ativo

Armazena o tema de cores (grid-theme), o estado de navegação da documentação e sua preferência de privacidade (fwdi_privacy_consent_v1) localmente no navegador. Não são definidos cookies de terceiros nem rastreadores entre sites.

O seletor de idioma armazena apenas sua preferência em um cookie próprio (fwdi-language), por até um ano. Isso não habilita análises opcionais.

Análise de navegação e funil com dados reduzidosDisabled

Coleta visualizações agregadas de páginas em rotas de marketing permitidas e eventos gerais do funil comercial por meio de @vercel/analytics. Parâmetros de consulta, caminhos dinâmicos e dados pessoais são removidos no navegador antes do envio.

Ler o aviso completo de GDPR / LGPD / CCPA