Skip to main content

Code Models

Generate, debug, and refactor code with Assisters Code, our specialized model for software development tasks.

Assisters Code v1

Our advanced code model optimized for programming tasks across multiple languages with deep understanding of software engineering principles.
SpecificationValue
Model IDassisters-code-v1
Context Window128,000 tokens
Max Output8,192 tokens
Input Price$0.10 / million tokens
Output Price$0.20 / million tokens
Latency~200ms first token

Capabilities

  • Code Generation: Write code from natural language descriptions
  • Debugging: Identify and fix bugs in existing code
  • Refactoring: Improve code quality and performance
  • Code Review: Analyze code for issues and best practices
  • Documentation: Generate docstrings and comments
  • Multi-language: Support for 50+ programming languages

Supported Languages

Python, JavaScript, TypeScript, Java, C++, C#, Go, Rust, Ruby, PHP, Swift, Kotlin, Scala, R, MATLAB, SQL, HTML, CSS, Shell/Bash, and many more.

Example Usage

from openai import OpenAI

client = OpenAI(
    base_url="https://api.assisters.dev/v1",
    api_key="your-api-key"
)

response = client.chat.completions.create(
    model="assisters-code-v1",
    messages=[
        {"role": "system", "content": "You are an expert software engineer."},
        {"role": "user", "content": "Write a Python function to find the nth Fibonacci number using memoization"}
    ]
)

print(response.choices[0].message.content)

Code Debugging

buggy_code = """
def binary_search(arr, target):
    left = 0
    right = len(arr)
    while left < right:
        mid = (left + right) / 2
        if arr[mid] == target:
            return mid
        elif arr[mid] < target:
            left = mid
        else:
            right = mid
    return -1
"""

response = client.chat.completions.create(
    model="assisters-code-v1",
    messages=[
        {"role": "system", "content": "You are a debugging expert."},
        {"role": "user", "content": f"Find and fix the bugs in this code:\n\n{buggy_code}"}
    ]
)

Code Review

response = client.chat.completions.create(
    model="assisters-code-v1",
    messages=[
        {"role": "system", "content": "You are a senior code reviewer. Provide constructive feedback."},
        {"role": "user", "content": f"Review this code for best practices, performance, and security:\n\n{code_to_review}"}
    ]
)

Parameters

ParameterTypeDefaultDescription
messagesarrayrequiredConversation history
temperaturefloat0.2Randomness (lower for code)
max_tokensint2048Maximum output length
streamboolfalseEnable streaming
stoparraynullStop sequences

Use Cases

Generate complete functions or modules:
response = client.chat.completions.create(
    model="assisters-code-v1",
    messages=[{
        "role": "user",
        "content": "Write a REST API endpoint in FastAPI that handles user authentication with JWT tokens"
    }],
    temperature=0.2
)
Create comprehensive test suites:
response = client.chat.completions.create(
    model="assisters-code-v1",
    messages=[
        {"role": "system", "content": "You are a test engineer. Write comprehensive unit tests."},
        {"role": "user", "content": f"Write pytest tests for this function:\n\n{function_code}"}
    ]
)
Explain complex code:
response = client.chat.completions.create(
    model="assisters-code-v1",
    messages=[{
        "role": "user",
        "content": f"Explain this code step by step:\n\n{complex_code}"
    }]
)
Convert between languages:
response = client.chat.completions.create(
    model="assisters-code-v1",
    messages=[{
        "role": "user",
        "content": f"Convert this Python code to TypeScript:\n\n{python_code}"
    }]
)

Best Practices

Use Low Temperature

Set temperature to 0.1-0.3 for more deterministic code output

Provide Context

Include relevant code context for better understanding

Specify Language

Clearly state the programming language you want

Review Output

Always review and test generated code before use

Tips for Better Results

  1. Be specific: “Write a function that…” is better than “Help me with…”
  2. Include requirements: Mention edge cases, error handling, and performance needs
  3. Provide examples: Show input/output examples when possible
  4. Iterate: Use follow-up messages to refine the code