Docs/API Reference

Code Generation

Generate production-ready code in any language using the Chat API.

There's no separate code endpoint: you use the regular Chat API with a good system message. It's great for scaffolding, boilerplate and quick prototypes.

Example: a React login form

curl -X POST "https://api.tarqaai.com/api/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-flash",
    "messages": [
      { "role": "system", "content": "You are an expert React developer. Generate clean, production-ready code." },
      { "role": "user", "content": "Create a responsive login form component with email, password fields, and form validation." }
    ]
  }'

It works for any language, including JavaScript, TypeScript, Python, Java, Go, Rust, PHP and Ruby.

Get better code

TipWhy it helps
Be specificName the framework, versions and style you want.
Set standards in the system messageIt applies to every reply in the conversation.
Ask for comments and docsGenerated code is easier to review.
Ask for error handling and edge casesModels skip these unless you ask.
Try a few models for code. Change only the model field and compare the results.