Code generation
Write, review and fix code with the models — and which one to use in each case.
Updated on Aug 09, 2026
The HINOW models can generate, explain, review and transform code. Start with hinow/himax when the task involves architecture, business rules or higher-risk changes. Use hinow/hicode in specialized pipelines and compare HiNova or HiGenesis for more straightforward tasks.
- Explore — iterate on the prompt in the playground until the response has the shape you want.
- Integrate — call
POST https://api.hinow.ai/v1/chat/completionsfrom inside your workflow: pull request review, test generation, legacy code migration.
The example below sends a function with an indexing error. temperature: 0 reduces variation between runs, but tests and review are still required before applying any suggestion.
curl https://api.hinow.ai/v1/chat/completions \
-H "Authorization: Bearer $HINOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "hinow/himax",
"temperature": 0,
"messages": [
{"role": "system", "content": "Você revisa código. Aponte o bug, explique em uma frase e proponha a correção mínima."},
{"role": "user", "content": "function ultimaLinha(linhas) {\n return linhas[linhas.length];\n}"}
]
}'from openai import OpenAI
import os
client = OpenAI(base_url="https://api.hinow.ai/v1", api_key=os.environ["HINOW_API_KEY"])
codigo = """function ultimaLinha(linhas) {
return linhas[linhas.length];
}"""
resposta = client.chat.completions.create(
model="hinow/himax",
temperature=0,
messages=[
{"role": "system", "content": "Você revisa código. Aponte o bug, explique em uma frase e proponha a correção mínima."},
{"role": "user", "content": codigo},
],
)
print(resposta.choices[0].message.content)import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.hinow.ai/v1',
apiKey: process.env.HINOW_API_KEY,
});
const codigo = 'function ultimaLinha(linhas) {\n return linhas[linhas.length];\n}';
const resposta = await client.chat.completions.create({
model: 'hinow/himax',
temperature: 0,
messages: [
{ role: 'system', content: 'Você revisa código. Aponte o bug, explique em uma frase e proponha a correção mínima.' },
{ role: 'user', content: codigo },
],
});
console.log(resposta.choices[0].message.content);The response to this call, exactly as the API returned it:
**Bug:** O índice `linhas.length` está fora dos limites do array (deveria ser `linhas.length - 1`).
**Correção:** `return linhas[linhas.length - 1];`The response identifies the problem and proposes the minimal change. In production, validate the diff with automated tests, static analysis and the review rules of the repository.
For automated review, test generation and repetitive transformations, the catalog offers hinow/hicode, a model specialized in code. The current price is available in Pricing and in GET https://api.hinow.ai/v1/models:
**Bug:** O índice `linhas.length` está fora dos limites do array (deveria ser `linhas.length - 1`).
**Correção:**
```javascript
function ultimaLinha(linhas) {
return linhas[linhas.length - 1];
}
```Use hinow/himax when the review requires product context and architectural decisions. Consider hinow/hicode when input and output are well defined and the workflow processes code at volume.
Send the diff in user and define the format of the review in system. Asking for file and line helps tie each remark to the code under analysis and makes validation easier:
Você revisa pull requests.
Para cada problema encontrado:
- Cite o arquivo e a linha.
- Classifique: bug | risco | estilo.
- Explique em uma frase e proponha a correção mínima, como diff.
Aponte no máximo os 5 problemas mais importantes. Se não houver
problema relevante, escreva apenas "LGTM" e o motivo em uma frase.Send the function and describe the project structure: framework, naming convention and where the tests live. Include the edge cases that matter for the domain, such as empty values, nulls, boundaries and expected errors.
Você escreve testes unitários em Jest.
Regras:
- Um describe por função; um it por comportamento.
- Cubra o caminho feliz e os casos de borda: entrada vazia,
nula, no limite e inválida.
- Sem mock do que não é externo.
- Responda apenas com o arquivo de teste, completo.Repetitive transformations — swapping an API or updating a syntax — work better with explicit input, output and acceptance criteria. hinow/higenesis is an economical option for well-bounded tasks. Return {"arquivo": ..., "codigo_novo": ...}, validate the JSON and run tests before writing the result.
When generating interfaces, state the framework, the visual library, the accessibility requirements and states such as empty, loading, success and error. hinow/hinova is a good starting point for fast iteration; use HiMax when the task involves architecture or a broad change to the product.
| Task | Model | Why |
|---|---|---|
| Architecture and refactoring with context | hinow/himax | Prioritizes capability on complex tasks |
| Pipelines specialized in code | hinow/hicode | Focused on code generation and transformation |
| Iteration and assisted development | hinow/hinova | Balances quality, speed and cost |
| Simple batch transformation | hinow/higenesis | Economical for straightforward, repeatable tasks |

